Jump to content

Keyword confusion?


Recommended Posts

Hello!

 

In a project (without any/ *CL headers, this compiles:

ShowMessage('hello');

but (naturally) the browser will throw an exception as the external declaration for ShowMessage is in SmartCL.System.pas.

 

I'm just notifying because it feels like this may be a symptom of something worse.

 

Regards,

 

/Dany

Link to post
Share on other sites

This is known. The procedure ShowMessage is implemented in the RTL of DWScript but not in the mini RTL of the JS CodeGen. So in order to use it you must have a line that reads:

procedure ShowMessage(aText: String); external 'alert';

This said, it will only work for JS implementations that has the 'alert' function implemented. For the NodeJS, Espruino or PhantomJS target this is likely not the case (or at least different to what you would expect). For these you might want to write your own custom code, which is why this is not hard coded in the DWScript JS CodeGen's mini RTL.

Link to post
Share on other sites

Yes, it's closed source but you can still find it in the DWScript repository before this commit: 

 

https://bitbucket.org/egrange/dwscript/commits/5daed7cba1ca63becd9245738c25ba0b394dcdfc

 

It hasn't changed that much in the meantime. The file you might want to look at is: Libraries\JSCodeGen\dwsJSRTL.pas or the Libraries\JSCodeGen\rtl subdirectory. It contains the intrinsics and some OOP related code.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...