Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
super should be available in object literals
https://bugs.webkit.org/show_bug.cgi?id=156933 Reviewed by Saam Barati. Source/JavaScriptCore: When we originally implemented classes, super seemed to be a class-only feature. But the final spec says it's available in object literals too. * bytecompiler/NodesCodegen.cpp: (JSC::PropertyListNode::emitBytecode): Having 'super' and being a class property are no longer synonymous, so we track two separate variables. (JSC::PropertyListNode::emitPutConstantProperty): Being inside the super branch no longer guarantees that you're a class property, so we decide our attributes and our function name dynamically. * parser/ASTBuilder.h: (JSC::ASTBuilder::createArrowFunctionExpr): (JSC::ASTBuilder::createGetterOrSetterProperty): (JSC::ASTBuilder::createArguments): (JSC::ASTBuilder::createArgumentsList): (JSC::ASTBuilder::createProperty): (JSC::ASTBuilder::createPropertyList): Pass through state to indicate whether we're a class property, since we can't infer it from 'super' anymore. * parser/NodeConstructors.h: (JSC::PropertyNode::PropertyNode): See ASTBuilder.h. * parser/Nodes.h: (JSC::PropertyNode::expressionName): (JSC::PropertyNode::name): (JSC::PropertyNode::type): (JSC::PropertyNode::needsSuperBinding): (JSC::PropertyNode::isClassProperty): (JSC::PropertyNode::putType): See ASTBuilder.h. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseFunctionInfo): (JSC::Parser<LexerType>::parseClass): (JSC::Parser<LexerType>::parseProperty): (JSC::Parser<LexerType>::parsePropertyMethod): (JSC::Parser<LexerType>::parseGetterSetter): (JSC::Parser<LexerType>::parseMemberExpression): I made these error messages generic because it is no longer practical to say concise things about the list of places you can use super. * parser/Parser.h: * parser/SyntaxChecker.h: (JSC::SyntaxChecker::createArgumentsList): (JSC::SyntaxChecker::createProperty): (JSC::SyntaxChecker::appendExportSpecifier): (JSC::SyntaxChecker::appendConstDecl): (JSC::SyntaxChecker::createGetterOrSetterProperty): Updated for interface change. * tests/stress/generator-with-super.js: (test): * tests/stress/modules-syntax-error.js: * tests/stress/super-in-lexical-scope.js: (testSyntaxError): (testSyntaxError.test): * tests/stress/tagged-templates-syntax.js: Updated for error message changes. See Parser.cpp. LayoutTests: Updated expected results and added a few new tests. * js/arrowfunction-syntax-errors-expected.txt: * js/class-syntax-super-expected.txt: * js/object-literal-methods-expected.txt: * js/script-tests/arrowfunction-syntax-errors.js: * js/script-tests/class-syntax-super.js: * js/script-tests/object-literal-methods.js: Canonical link: https://commits.webkit.org/175044@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199927 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
247 additions
and 133 deletions.
- +16 −0 LayoutTests/ChangeLog
- +14 −14 LayoutTests/js/arrowfunction-syntax-errors-expected.txt
- +14 −14 LayoutTests/js/class-syntax-super-expected.txt
- +8 −0 LayoutTests/js/object-literal-methods-expected.txt
- +14 −14 LayoutTests/js/script-tests/arrowfunction-syntax-errors.js
- +16 −16 LayoutTests/js/script-tests/class-syntax-super.js
- +9 −0 LayoutTests/js/script-tests/object-literal-methods.js
- +1 −1 ...nformance/07_Lexical_Conventions/7.5_Tokens/7.5.3_Future_Reserved_Words/S7.5.3_A1.27-expected.txt
- +68 −0 Source/JavaScriptCore/ChangeLog
- +16 −11 Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
- +11 −11 Source/JavaScriptCore/parser/ASTBuilder.h
- +4 −2 Source/JavaScriptCore/parser/NodeConstructors.h
- +4 −2 Source/JavaScriptCore/parser/Nodes.h
- +31 −27 Source/JavaScriptCore/parser/Parser.cpp
- +1 −1 Source/JavaScriptCore/parser/Parser.h
- +6 −6 Source/JavaScriptCore/parser/SyntaxChecker.h
- +1 −1 Source/JavaScriptCore/tests/stress/generator-with-super.js
- +3 −3 Source/JavaScriptCore/tests/stress/modules-syntax-error.js
- +9 −9 Source/JavaScriptCore/tests/stress/super-in-lexical-scope.js
- +1 −1 Source/JavaScriptCore/tests/stress/tagged-templates-syntax.js
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.