Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2020-12

Force pas2js to transpile unused code

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner
to imperyal
Show quoted text 5 lines
In my use case, I call lots of functions from other JS code only, not within the pascal code. I already tried -O- option on pas2js.cfg file. No luck. I'm using Lazarus with pas2js.

Lazarus passes by default -O1.

Add the -O- in Project / Project Options / Compiler Options / Custom Options.

Mattias

Reply by email

Mattias Gaertner
to Mattias Gaertner
Show quoted text 13 lines
On Thu, 17 Dec 2020 10:06:40 -0700 (MST) imperyal wrote: > In my use case, I call lots of functions from other JS code only, > not within the pascal code. > I already tried -O- option on pas2js.cfg file. No luck. > > I'm using Lazarus with pas2js. Lazarus passes by default -O1. Add the -O- in Project / Project Options / Compiler Options / Custom Options.

Or better, add somewhere:

var dummy: jsvalue;
begin
  ;
  ;
  ...

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner: On Thu, 17 Dec 2020 10:06:40 -0700 (MST) Lazarus passes by default -O1. Add the -O- in…
Mattias Gaertner wrote 13 lines
On Thu, 17 Dec 2020 10:06:40 -0700 (MST) imperyal wrote: > In my use case, I call lots of functions from other JS code only, not > within the pascal code. > I already tried -O- option on pas2js.cfg file. No luck. > > I'm using Lazarus with pas2js. Lazarus passes by default -O1. Add the -O- in Project / Project Options / Compiler Options / Custom Options.

This will generate a warning that the same option is passed multiple times with different values. (guess how I know that...)

You can also uncheck the 'optimizations' in the compiler settings. This will silence the warning.

Michael.

Reply by email