[Pas2js] Compiler Options as Hints in Pas sources?
Michael Van Canneyt
michael at freepascal.org
Fri Dec 21 11:38:03 CET 2018
Hi,
I had a quick look to see how this should be implemented, with the idea to
take some of the load off you. It turns out to be a little more complicated
than simply parsing the flag :)
Since this would be a local switch, this requires quite some changes, as the
units or identifiers need to be tagged. Maybe a simple solution would be to
keep a local flag in TPas2JSCompilerFile and mark all the identifiers simply
as used while parsing when in RemoveNotUsedDeclarations. So
function TPas2jsCompilerFile.OnConverterIsElementUsed(Sender: TObject;
El: TPasElement): boolean;
begin
if Not LocalRemoveNotUsedDeclarationsFlag then
Result:=False
else
// The rest.
end;
What do you think ?
Michael.
On Fri, 21 Dec 2018, Mattias Gaertner via Pas2js wrote:
> On Fri, 21 Dec 2018 12:42:51 +0300
> Sergei Vertiev <vertiev at gmail.com> wrote:
>
>> 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.
>
> That is what Michael meant. The
> {$optimization RemoveNotUsedDeclarations-}
> is not yet implemented.
>
> Mattias
> _______________________________________________
> Pas2js maillist - Pas2js at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
More information about the Pas2js
mailing list