[Pas2js] Disable optimization in specific units/blocks

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jan 10 22:58:32 CET 2019


On Thu, 10 Jan 2019 18:25:57 -0300
silvioprog <silvioprog at gmail.com> wrote:

> Hello,
> 
> I've got a problem in a code I'm maintaining that uses some
> asm-blocks and the final script must be built using the compiler
> optimization. The problem is: my JS code is completely removed.
> 
> So, is there some option to disable the optimization in specific
> parts of the project? For example:
> 
> {$PUSH}{$SOMETHING_TO_DISABLE_THE_OPTIMIZATION_HERE OFF}
> 
> procedure Foo;
> asm
>   // ... my very required Vanilla JS polyfill here ...
> end;
> 
> {$POP}

Notes:
Neither $PUSH, $POP nor the $optimizations directive is yet
supported.
pas2js does not parse the asm block, so it has no idea what it uses.

At the moment you must use some dummy code like "if false then
reference..." to tell the compiler which identifiers are used.

Mattias


More information about the Pas2js mailing list