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

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jun 6 11:51:58 CEST 2019


On Wed, 5 Jun 2019 20:03:29 -0400
Logan Ralston <logan.k.ralston at gmail.com> wrote:

> 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?

I fixed it in svn trunk and fixes.

Mattias


More information about the Pas2js mailing list