Changeset 188018 in webkit
- Timestamp:
- Aug 5, 2015 9:01:00 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r188017 r188018 1 2015-08-05 Ryosuke Niwa <rniwa@webkit.org> 2 3 [ES6] Class parser does not allow methods named set and get. 4 https://bugs.webkit.org/show_bug.cgi?id=147150 5 6 Reviewed by Oliver Hunt. 7 8 Added a regression test and rebaselined a test. 9 10 * js/class-syntax-method-names-expected.txt: Added. 11 * js/class-syntax-method-names.html: Added. 12 * js/class-syntax-semicolon-expected.txt: Rebaselined as the error message got improved. 13 * js/script-tests/class-syntax-method-names.js: Added. 14 * js/script-tests/class-syntax-semicolon.js: 15 1 16 2015-08-05 Nikita Vasilyev <nvasilyev@apple.com> 2 17 -
trunk/LayoutTests/js/class-syntax-semicolon-expected.txt
r183383 r188018 6 6 PASS class A { foo;() { } } threw exception SyntaxError: Unexpected token ';'. Expected an opening '(' before a method's parameter list.. 7 7 PASS class A { foo() ; { } } threw exception SyntaxError: Unexpected token ';'. Expected an opening '{' at the start of a method body.. 8 PASS class A { get ; foo() { } } threw exception SyntaxError: Unexpected token ';'. 8 PASS class A { get ; foo() { } } threw exception SyntaxError: Unexpected token ';'. Expected an opening '(' before a method's parameter list.. 9 9 PASS class A { get foo;() { } } threw exception SyntaxError: Unexpected token ';'. Expected a parameter list for getter definition.. 10 10 PASS class A { get foo() ; { } } threw exception SyntaxError: Unexpected token ';'. Expected an opening '{' at the start of a getter body.. 11 PASS class A { set ; foo(x) { } } threw exception SyntaxError: Unexpected token ';'. 11 PASS class A { set ; foo(x) { } } threw exception SyntaxError: Unexpected token ';'. Expected an opening '(' before a method's parameter list.. 12 12 PASS class A { set foo;(x) { } } threw exception SyntaxError: Unexpected token ';'. Expected a parameter list for setter definition.. 13 13 PASS class A { set foo(x) ; { } } threw exception SyntaxError: Unexpected token ';'. Expected an opening '{' at the start of a setter body.. -
trunk/LayoutTests/js/script-tests/class-syntax-semicolon.js
r183392 r188018 5 5 shouldThrow("class A { foo;() { } }", "'SyntaxError: Unexpected token \\';\\'. Expected an opening \\'(\\' before a method\\'s parameter list.'"); 6 6 shouldThrow("class A { foo() ; { } }", "'SyntaxError: Unexpected token \\\';\\'. Expected an opening \\'{\\' at the start of a method body.'"); 7 shouldThrow("class A { get ; foo() { } }", "'SyntaxError: Unexpected token \\';\\' '");7 shouldThrow("class A { get ; foo() { } }", "'SyntaxError: Unexpected token \\';\\'. Expected an opening \\'(\\' before a method\\'s parameter list.'"); 8 8 shouldThrow("class A { get foo;() { } }", "'SyntaxError: Unexpected token \\\';\\'. Expected a parameter list for getter definition.'"); 9 9 shouldThrow("class A { get foo() ; { } }", "'SyntaxError: Unexpected token \\\';\\'. Expected an opening \\'{\\' at the start of a getter body.'"); 10 shouldThrow("class A { set ; foo(x) { } }", "'SyntaxError: Unexpected token \\';\\' '");10 shouldThrow("class A { set ; foo(x) { } }", "'SyntaxError: Unexpected token \\';\\'. Expected an opening \\'(\\' before a method\\'s parameter list.'"); 11 11 shouldThrow("class A { set foo;(x) { } }", "'SyntaxError: Unexpected token \\\';\\'. Expected a parameter list for setter definition.'"); 12 12 shouldThrow("class A { set foo(x) ; { } }", "'SyntaxError: Unexpected token \\\';\\'. Expected an opening \\'{\\' at the start of a setter body.'"); -
trunk/Source/JavaScriptCore/ChangeLog
r188002 r188018 1 2015-08-05 Ryosuke Niwa <rniwa@webkit.org> 2 3 [ES6] Class parser does not allow methods named set and get. 4 https://bugs.webkit.org/show_bug.cgi?id=147150 5 6 Reviewed by Oliver Hunt. 7 8 The bug was caused by parseClass assuming identifiers "get" and "set" could only appear 9 as the leading token for getter and setter methods. Fixed the bug by generalizing the code 10 so that we only treat them as such when it's followed by another token that could be a method name. 11 12 * parser/Parser.cpp: 13 (JSC::Parser<LexerType>::parseClass): 14 1 15 2015-08-05 Filip Pizlo <fpizlo@apple.com> 2 16 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r187890 r188018 1951 1951 case IDENT: 1952 1952 ident = m_token.m_data.ident; 1953 isGetter = *ident == propertyNames.get;1954 isSetter = *ident == propertyNames.set;1955 1953 ASSERT(ident); 1954 next(); 1955 if (match(IDENT) || match(STRING) || match(DOUBLE) || match(INTEGER)) { 1956 isGetter = *ident == propertyNames.get; 1957 isSetter = *ident == propertyNames.set; 1958 } 1956 1959 break; 1957 1960 case DOUBLE: … … 1968 1971 const bool alwaysStrictInsideClass = true; 1969 1972 if (isGetter || isSetter) { 1970 nextExpectIdentifier(LexerFlagsIgnoreReservedWords);1971 1973 property = parseGetterSetter(context, alwaysStrictInsideClass, isGetter ? PropertyNode::Getter : PropertyNode::Setter, methodStart, 1972 1974 ConstructorKind::None, SuperBinding::Needed);
Note: See TracChangeset
for help on using the changeset viewer.