Invalid octal literal in strict mode

94 views
Skip to first unread message

pcxunl...@gmail.com

unread,
Aug 31, 2014, 8:42:39 PM8/31/14
to strati...@googlegroups.com
I tried adding "use strict"; to the compiled SJS code, and it turns out that the debug.sjs module uses octal literals, which are not allowed in strict mode. Line 155, in the stylizeWithColor function. The fix is easy: just replace '\033[' with '\u001b['.

On a more general note, I think the output from SJS should always be valid in strict mode (especially since ES6 will have strict mode on by default for ES6 modules). So I would suggest changing the compiler so it detects invalid things (like octal literals) and throws an error.

Tim Cuthbertson

unread,
Sep 1, 2014, 7:49:07 PM9/1/14
to strati...@googlegroups.com, pcxunl...@gmail.com
Thanks for pointing this out, I've changed this in the debug module.

Making all SJS compiler output valid in strict mode is also a good idea, but not something that can be done trivially, so I've added it to our (internal) task tracker.

Cheers,
 - Tim.

pcxunl...@gmail.com

unread,
Sep 1, 2014, 8:35:58 PM9/1/14
to strati...@googlegroups.com, pcxunl...@gmail.com
Sure, I understand.
Reply all
Reply to author
Forward
0 new messages