RunJS
RunJS copied to clipboard
Inaccurate `SyntaxError: 'with' in strict mode` error
I noticed this while pushing around our old buddy, the deprecated "with" statement. This is with Babel transpilation enabled, which I believe always enforces strict mode.
Running this is fine, and evaluates to 'true':
with (true) console.log(toString());
But if I create a syntax error within the "with" statement:
with (true) console.log(toString(!));
I get SyntaxError: 'with' in strict mode— even though it was happily using "with" in strict mode before I added nonsense.
@dajxd, thanks for raising this. It does seem odd. It's possibly an upstream issue. I'll take a deeper look.
Both statements throw the "with" error when run in Babel REPL. Does RunJS attempt to execute without Babel first and fall back to Babel if it errors?
@oculus42 nope, if Babel is enabled then it will use Babel.
@oculus42 try setting the source type in the Babel Repl to Unambiguous