After landing https://bugs.webkit.org/show_bug.cgi?id=153864 the patch we need to fix Syntax error message. It is recommended by Saam Barati to use new message "super is only valid inside functions or 'eval' inside a function".
The same for new.target "new.target is only valid inside functions" -> "new.target is only valid inside functions or 'eval' inside a function"
Created attachment 274515 [details] Patch
Comment on attachment 274515 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=274515&action=review > Source/JavaScriptCore/parser/Parser.cpp:3847 > + semanticFailIfFalse(currentScope()->isFunction() || (scopeRef->isEvalContext() && scopeRef->expectedSuperBinding() == SuperBinding::Needed), "super is only valid inside functions or 'eval' inside a function"); I vote for this message: "'super' is only valid inside a function or an 'eval' inside a function" Do you know what we do when we have 'super' inside a function not in a class? It looks like we accept that syntax. Do we throw a runtime error? Should that also be a syntax error? > Source/JavaScriptCore/tests/stress/generator-with-super.js:12 > + //debug(error); Remove
Comment on attachment 274515 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=274515&action=review >> Source/JavaScriptCore/parser/Parser.cpp:3847 >> + semanticFailIfFalse(currentScope()->isFunction() || (scopeRef->isEvalContext() && scopeRef->expectedSuperBinding() == SuperBinding::Needed), "super is only valid inside functions or 'eval' inside a function"); > > I vote for this message: > "'super' is only valid inside a function or an 'eval' inside a function" > > Do you know what we do when we have 'super' inside a function not in a class? > It looks like we accept that syntax. Do we throw a runtime error? Should that also > be a syntax error? OK. I'll change text message. According to the super inside a function not in a class, we will have syntax error also We have additional check if current function is constructor or method of class: http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/parser/Parser.cpp#L2078 >> Source/JavaScriptCore/tests/stress/generator-with-super.js:12 >> + //debug(error); > > Remove Ups...
Comment on attachment 274515 [details] Patch Committed r198472: <http://trac.webkit.org/changeset/198472>
All reviewed patches have been landed. Closing bug.