[Pas2js] Typecasting parser bug
Ryan Joseph
ryan at thealchemistguild.com
Mon May 14 04:16:04 CEST 2018
I have the following function which when typecast to TJSFloat32List returns the entire function body (in JS) as its value. This same code works if it’s done outside of a function but when I add the code as a method and typecast I get the bug.
function TMat4.CopyList: TJSArray;
var
x, y: integer;
list: TJSArray;
begin
list := TJSArray.new;
for x := 0 to 3 do
for y := 0 to 3 do
list.push(RawComponents[x,y]);
result := list;
end;
writeln(TJSFloat32List(projTransform.CopyList)); // from .js pas.System.Writeln($mod.projTransform.CopyList);
writeln prints:
function () {
var Result = null;
var x = 0;
var y = 0;
var list = null;
list = new Array();
for (x = 0; x <= 3; x++) for (y = 0; y <= 3; y++) list.push(this.RawComponents[x][y]);
Result = list;
return Result;
}
Regards,
Ryan Joseph
More information about the Pas2js
mailing list