-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Normative: Add "Late Errors for Function Call Assignment Targets" to Annex B #3568
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
base: main
Are you sure you want to change the base?
Normative: Add "Late Errors for Function Call Assignment Targets" to Annex B #3568
Conversation
Thanks! Web reality has the error occurring before evaluation of the RHS (try This is maybe what you're trying to achieve with the "Late Errors" section? But the spec doesn't have a notion of "late errors"; there's just parse failures, early errors which happen at the same time as parse errors, and errors which occur as explicit steps in the evaluation semantics or other AOs. Since this is not a parse failure it has to specified as an actual algorithmic step. |
Oops, yeah, I see that |
Interestingly, we don't have agreement among browsers on how far the LHS processing goes.
I am inclined to specify V8's behavior here; we should only go as far as web reality obliges us to. Edit: JSC's behavior has now been updated to match V8's. |
Okay, updated. Technically, nothing outside of AssignmentTargetType needs to be marked normative optional—for now, I've marked every usage of |
Added tests in tc39/test262#4459. |
https://bugs.webkit.org/show_bug.cgi?id=291882 Reviewed by Yusuke Suzuki. In tc39/ecma262#3568, we'll finally be specifying the web reality that `f() = 1` is not an early error in sloppy mode. JSC's behavior on this was mostly aligned with SM/V8's back in https://commits.webkit.org/212076@main, but there is one outstanding discrepancy to resolve: SM/V8 both call the function before throwing a ReferenceError. This patch resolves said discrepancy, which applies to not only =, but also += and kin (excluding logical assignment), ++ / --, and for-in/of. * JSTests/ChakraCore/test/Function/call1.baseline-jsc: * JSTests/ChakraCore/test/LetConst/tdz1.baseline-jsc: * JSTests/stress/sloppy-mode-function-call-assignment-targets.js: Added. * LayoutTests/js/modify-non-references-expected.txt: * LayoutTests/js/parser-syntax-check-expected.txt: * LayoutTests/js/script-tests/modify-non-references.js: * LayoutTests/svg/dom/SVGTransformList-anim-read-only-expected.txt: * Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp: (JSC::PostfixNode::emitBytecode): (JSC::PrefixNode::emitBytecode): (JSC::AssignErrorNode::emitBytecode): (JSC::ForInNode::emitBytecode): (JSC::ForOfNode::emitBytecode): * Source/JavaScriptCore/parser/ASTBuilder.h: (JSC::ASTBuilder::makeAssignNode): * Source/JavaScriptCore/parser/NodeConstructors.h: (JSC::AssignErrorNode::AssignErrorNode): * Source/JavaScriptCore/parser/Nodes.h: * Source/JavaScriptCore/parser/Parser.cpp: (JSC::Parser<LexerType>::isSimpleAssignmentTarget): Canonical link: https://commits.webkit.org/293996@main
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 otherwise!
Replaces #2193.
This PR specifies the web reality that the following are not early errors in sloppy mode on browser-hosted engines:
It aligns with the new Annex B editorial convention (#2952) and amounts to:
~web-compat~