Page 1 of 1
Problem with Optimize javascript output
Posted: Wed Jan 23, 2019 8:07 pm
by Paul
I have some code that compiles and runs fine but if I select "Optimize javascript output" under Compiler Options I receive an error and it will not compile...
Code: Select all
spiderbasic.js:522: WARNING - unreachable code
return 0;
^
spiderbasic.js:540: WARNING - unreachable code
return "";
^
...
Picked up _JAVA_OPTIONS: -Xmx512M
What would cause this and what should I be looking for to fix it?
(sorry I cannot post the source code)
Re: Problem with Optimize javascript output
Posted: Wed Jan 23, 2019 9:24 pm
by Peter
@Paul:
This is the output of a JavaScript linter.
For explanation:
The SB-Procedure:
is converted to
Code: Select all
function f_testproc() {
return 0;
}
(note the
return 0)
The SB-Procedure:
Code: Select all
Procedure TestProc()
ProcedureReturn 42
EndProcedure
is converted to
Code: Select all
function f_testproc() {
if (1) return 42;
return 0;
}
Here,
return 0 is unreachable because of
return 42
However, this is only a warning and should not interrupt the compile process.
Paul wrote:what should I be looking for to fix it?
do not use the Optimizer until further notice.
Greetings ... Peter
Re: Problem with Optimize javascript output
Posted: Sun Jul 21, 2019 8:28 am
by DanLJr
Any update? It's been another half a year and I'm doing some product release work now, and running into this problem myself all of a sudden. (It JUST started happening since I added some File Requester stuff that uses callbacks. Mostly right from the samples in the help file, and now after a year of working fine, stuff won't optimize. Same kind of error.) There's GOT to be a work-around... It's actually kind of important that I successfully optimize the JS for one particular project.
Please help!
-Dan
Peter wrote:@Paul:
This is the output of a JavaScript linter.
For explanation:
The SB-Procedure:
is converted to
Code: Select all
function f_testproc() {
return 0;
}
(note the
return 0)
The SB-Procedure:
Code: Select all
Procedure TestProc()
ProcedureReturn 42
EndProcedure
is converted to
Code: Select all
function f_testproc() {
if (1) return 42;
return 0;
}
Here,
return 0 is unreachable because of
return 42
However, this is only a warning and should not interrupt the compile process.
Paul wrote:what should I be looking for to fix it?
do not use the Optimizer until further notice.
Greetings ... Peter