Page 1 of 1

Option to preserve function names in Output Js file

Posted: Thu May 28, 2015 5:22 pm
by eddy
Hi,
I wonder why functions are renamed in debug mode ?

SB continues to rename functions even if I uncheck 'optimize javascript output' option.

Re: Option to preserve function names

Posted: Sat May 30, 2015 2:16 pm
by Fred
What do you mean by 'renamed' ?

Re: Option to preserve function names

Posted: Sat May 30, 2015 2:18 pm
by eddy
For example :

Code: Select all

Procedure Calc ()  ;--------------> becomes Proc0 in js output file
EndProcedure

Procedure Move ()  ;--------------> becomes Proc1 in js output file
EndProcedure
Is it possible to add a prefix ?

Code: Select all

Procedure Move ()  ;--------------> will become proc_Move, pr_Move or sb_Move
EndProcedure

Re: Option to preserve function names in Output Js file

Posted: Sat May 30, 2015 3:09 pm
by skywalk
Is this intended as obfuscation of the source code?

Re: Option to preserve function names in Output Js file

Posted: Wed Jun 03, 2015 8:33 pm
by Fred
It was a bit easier for code generation, but I have to admit it does not fit well with inline JS feature. I think we will uses the 'sb_procname' all in lowercase in a next version.

Re: Option to preserve function names in Output Js file

Posted: Wed Jun 10, 2015 12:55 pm
by the.weavster
Fred wrote:I think we will uses the 'sb_procname' all in lowercase in a next version.
Any idea of the ETA for that version? This feature would come in dead handy right now :)

Re: Option to preserve function names in Output Js file

Posted: Wed Jun 10, 2015 1:18 pm
by the.weavster
And could we have something like this (maybe there's already a way to do this?):

Code: Select all

Procedure proc_1()
  !var obj = {};
  !obj["greeting"] = "Hello, World!";
  !sb_proc_2(obj);
EndProcedure

Procedure proc_2(*obj)
  !alert(v_obj["greeting"]);
EndProcedure
So that we can pass JS objects around without having to convert them to SB types.