[Pas2js] Compiler Options as Hints in Pas sources?
Sergei Vertiev
vertiev at gmail.com
Fri Dec 21 10:42:51 CET 2018
Hello, Michael.
Thanks for your replay.
I afraid that In case of "-O-" option, which i can set only
for all project files, resulting JS code will be too large.
I don't know how to set this option individually for one file in project.
Just using compilation via bat file - that is not convenient.
On Fri, Dec 21, 2018 at 10:47 AM Michael Van Canneyt
<michael at freepascal.org> wrote:
>
>
>
> On Thu, 20 Dec 2018, Sergei Vertiev wrote:
>
> > 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...
>
> For the moment, you will have to use -O-
>
> But implementing some switch should be possible. I don't think this should
> be a mode switch (they control language features) but an optimization
> switch, as they exist in FPC itself:
>
> https://www.freepascal.org/docs-html/current/prog/progsu58.html
>
>
> Michael.
> _______________________________________________
> Pas2js maillist - Pas2js at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
More information about the Pas2js
mailing list