[Pas2js] Compiler Options as Hints in Pas sources?

Sergei Vertiev vertiev at gmail.com
Thu Dec 20 20:58:01 CET 2018


Hi All pas2js gurus!
What if i want to use modules/functions/classes (generated from Pas
sources by pas2js) from manually written JS code?
Does really such scenario assumed somehow? Is there some best
practices concerning this?

In this case i probably will have some modules/functions/classes not
used from other Pas modules but intended to be used directly from JS
code.

But all declarations, not used in other Pas modules, are simply
ignored by pas2js,
probably because of following optimization swithes:
-OoRemoveNotUsedPrivates[-] : Default is enabled
-OoRemoveNotUsedDeclarations[-] : Default enabled for programs with -Jc

Is there some way to specify some pas2js Compiler hints in some PAS
sources for set this optimization OFF?
E.g. something like this.
{$modeswitch $OoRemoveNotUsedDeclarations-}
or may be
{$pas2js -OoRemoveNotUsedDeclarations-} would be better...

BTW, is there some possibilty to change compilation options in p2js -
Lazarus project
for some specific file(s) in project?

Thanks.


More information about the Pas2js mailing list