Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inaccurate SyntaxError: 'with' in strict mode error #573

Open
DaveMcNamara opened this issue Aug 9, 2023 · 4 comments
Open

Inaccurate SyntaxError: 'with' in strict mode error #573

DaveMcNamara opened this issue Aug 9, 2023 · 4 comments

Comments

@DaveMcNamara
Copy link

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.

@lukehaas
Copy link
Owner

@dajxd, thanks for raising this. It does seem odd. It's possibly an upstream issue. I'll take a deeper look.

@oculus42
Copy link

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?

@lukehaas
Copy link
Owner

@oculus42 nope, if Babel is enabled then it will use Babel.

@lukehaas
Copy link
Owner

@oculus42 try setting the source type in the Babel Repl to Unambiguous

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants