Bug 155491

Summary: [ES6] Arrow function syntax. Update syntax error text 'super is only valid inside functions' to more suitable
Product: WebKit Reporter: GSkachkov <gskachkov>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, keith_miller, mark.lam, msaboff, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 153864    
Bug Blocks: 140855    
Attachments:
Description Flags
Patch none

GSkachkov
Reported 2016-03-15 07:03:14 PDT
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".
Attachments
Patch (12.97 KB, patch)
2016-03-19 08:36 PDT, GSkachkov
no flags
GSkachkov
Comment 1 2016-03-18 12:54:08 PDT
The same for new.target "new.target is only valid inside functions" -> "new.target is only valid inside functions or 'eval' inside a function"
GSkachkov
Comment 2 2016-03-19 08:36:39 PDT
Saam Barati
Comment 3 2016-03-19 09:57:19 PDT
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
GSkachkov
Comment 4 2016-03-19 10:43:34 PDT
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...
GSkachkov
Comment 5 2016-03-20 00:42:42 PDT
GSkachkov
Comment 6 2016-03-20 00:43:06 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.