[Pas2js] TPrimitiveExpr error when assign variable in an anonymous procedure inside a for loop

Logan Ralston logan.k.ralston at gmail.com
Thu Jun 6 02:03:29 CEST 2019


Hi,

I've encountered a rather odd error in that whenever I attempt to assign a
variable inside an anonymous procedure that is inside of a for loop, the
program will not compile. However I can call a function that just sets the
value of that variable and the program will compile (though I would prefer
not to have to use this work around as it is quite bad form).

Example code:

for i := 0 to 10 do begin
      document.querySelector('#inputName').addEventListener('click',
procedure begin
         // Won't compile (citing TPrimitiveExpr not yet implemented error)
         someVariable := 5;

         // Works perfectly fine
         setSomeVariableToValue(5);

         // Works perfectly fine
         asm
            someVariable = 5;
         end;
      end);
end;

Does anyone know a way around this?

Thanks,
Logan Ralston
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20190605/dc89fcb1/attachment.html>


More information about the Pas2js mailing list