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
fix: "use strict" should not trigger strict mode in es3. #547
Conversation
5b853b6
to
089a6fd
Compare
089a6fd
to
9729e78
Compare
"value": "use strict", | ||
"raw": "\"use strict\"" | ||
}, | ||
"directive": "use strict" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this should be reported to Acorn as a possible bug. As far as I know, ES3 didn't have the concept of directive prologues, so maybe no nodes should be parsed as Directive nodes in ES3 mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 sounds a bug in acorn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. This seems like a bug in Acorn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
I think we should merge this (and release it next week) regardless of #547 (comment) to ensure consistent behavior of Espree in regard to whether parsing produces syntax errors or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test for a function-level directive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.