haikuwebkit/LayoutTests/js/class-syntax-string-and-num...

9 lines
229 B
HTML
Raw Permalink Normal View History

Class syntax should allow string and numeric identifiers for method names https://bugs.webkit.org/show_bug.cgi?id=144254 Reviewed by Darin Adler. Source/JavaScriptCore: Added the support for string and numeric identifiers in class syntax. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseFunctionInfo): Instead of using ConstructorKind to indicate whether we're inside a class or not, use the newly added SuperBinding argument instead. ConstructorKind is now None outside a class constructor as it should be. (JSC::Parser<LexerType>::parseFunctionDeclaration): (JSC::Parser<LexerType>::parseClass): No longer expects an identifier at the beginning of every class element to allow numeric and string method names. For both of those method names, parse it here instead of parseFunctionInfo since it doesn't support either type. Also pass in SuperBinding::Needed. (JSC::Parser<LexerType>::parsePropertyMethod): Call parseFunctionInfo with SuperBinding::NotNeeded since this function is never used to parse a class method. (JSC::Parser<LexerType>::parseGetterSetter): Pass in superBinding argument to parseFunctionInfo. (JSC::Parser<LexerType>::parsePrimaryExpression): Call parseFunctionInfo with SuperBinding::NotNeeded. * parser/Parser.h: * parser/SyntaxChecker.h: (JSC::SyntaxChecker::createProperty): LayoutTests: Added a test and rebaselined other tests per syntax error message change. * js/class-syntax-declaration-expected.txt: * js/class-syntax-expression-expected.txt: * js/class-syntax-string-and-numeric-names-expected.txt: Added. * js/class-syntax-string-and-numeric-names.html: Added. * js/class-syntax-super-expected.txt: * js/script-tests/class-syntax-declaration.js: * js/script-tests/class-syntax-expression.js: * js/script-tests/class-syntax-string-and-numeric-names.js: Added. * js/script-tests/class-syntax-super.js: Canonical link: https://commits.webkit.org/162546@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183709 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-02 02:23:01 +00:00
<!DOCTYPE html>
<html>
<body>
<script src="../resources/js-test-pre.js"></script>
<script src="script-tests/class-syntax-string-and-numeric-names.js"></script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>