Changeset 199927 in webkit
- Timestamp:
- Apr 22, 2016 4:04:55 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r199907 r199927 1 2016-04-22 Geoffrey Garen <ggaren@apple.com> 2 3 super should be available in object literals 4 https://bugs.webkit.org/show_bug.cgi?id=156933 5 6 Reviewed by Saam Barati. 7 8 Updated expected results and added a few new tests. 9 10 * js/arrowfunction-syntax-errors-expected.txt: 11 * js/class-syntax-super-expected.txt: 12 * js/object-literal-methods-expected.txt: 13 * js/script-tests/arrowfunction-syntax-errors.js: 14 * js/script-tests/class-syntax-super.js: 15 * js/script-tests/object-literal-methods.js: 16 1 17 2016-04-22 Ryan Haddad <ryanhaddad@apple.com> 2 18 -
trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt
r197554 r199927 132 132 PASS var arr3 = {c:a,d:b} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration.. 133 133 PASS var arr3 = {c:b,d:a} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration.. 134 PASS var arr4 = () => { super(); }; threw exception SyntaxError: Cannot call super() outside of a class constructor..135 PASS var arr4 = () => { super; }; threw exception SyntaxError: Cannot reference super..136 PASS var arr5 = () => { super.getValue(); }; threw exception SyntaxError: super can only be used in a method of a derived class..137 PASS var arr6 = () => super(); threw exception SyntaxError: Cannot call super() outside of a class constructor..138 PASS var arr7 = () => super; threw exception SyntaxError: Cannot reference super..139 PASS var arr8 = () => super.getValue(); threw exception SyntaxError: super can only be used in a method of a derived class..140 PASS class A { constructor() { function a () { return () => { super(); };}} threw exception SyntaxError: Cannot call super() outside of a class constructor..141 PASS class B { constructor() { function b () { return () => { super; }; }; }} threw exception SyntaxError: Cannot reference super..142 PASS class C { constructor() { function c () { return () => { super.getValue(); };}} threw exception SyntaxError: super can only be used in a method of a derived class..143 PASS class D { constructor() { function a () { return () => super(); }} threw exception SyntaxError: Cannot call super() outside of a class constructor..144 PASS class E { constructor() { function b () { return () => super; }; }} threw exception SyntaxError: Cannot reference super..145 PASS class F { constructor() { function c () { return () => super.getValue(); }} threw exception SyntaxError: super can only be used in a method of a derived class..146 PASS class G {}; class G2 extends G { getValue() { function c () { return () => super.getValue(); }} threw exception SyntaxError: super can only be used in a method of a derived class..147 PASS class H {}; class H2 extends H { method() { function *gen() { let arr = () => super.getValue(); arr(); } } } threw exception SyntaxError: super can only be used in a method of a derived class..134 PASS var arr4 = () => { super(); }; threw exception SyntaxError: super is not valid in this context.. 135 PASS var arr4 = () => { super; }; threw exception SyntaxError: super is not valid in this context.. 136 PASS var arr5 = () => { super.getValue(); }; threw exception SyntaxError: super is not valid in this context.. 137 PASS var arr6 = () => super(); threw exception SyntaxError: super is not valid in this context.. 138 PASS var arr7 = () => super; threw exception SyntaxError: super is not valid in this context.. 139 PASS var arr8 = () => super.getValue(); threw exception SyntaxError: super is not valid in this context.. 140 PASS class A { constructor() { function a () { return () => { super(); };}} threw exception SyntaxError: super is not valid in this context.. 141 PASS class B { constructor() { function b () { return () => { super; }; }; }} threw exception SyntaxError: super is not valid in this context.. 142 PASS class C { constructor() { function c () { return () => { super.getValue(); };}} threw exception SyntaxError: super is not valid in this context.. 143 PASS class D { constructor() { function a () { return () => super(); }} threw exception SyntaxError: super is not valid in this context.. 144 PASS class E { constructor() { function b () { return () => super; }; }} threw exception SyntaxError: super is not valid in this context.. 145 PASS class F { constructor() { function c () { return () => super.getValue(); }} threw exception SyntaxError: super is not valid in this context.. 146 PASS class G {}; class G2 extends G { getValue() { function c () { return () => super.getValue(); }} threw exception SyntaxError: super is not valid in this context.. 147 PASS class H {}; class H2 extends H { method() { function *gen() { let arr = () => super.getValue(); arr(); } } } threw exception SyntaxError: super is not valid in this context.. 148 148 PASS successfullyParsed is true 149 149 -
trunk/LayoutTests/js/class-syntax-super-expected.txt
r199724 r199927 17 17 PASS (new SecondDerived).chainMethod().toString():::["base", "derived", "secondDerived"].toString() 18 18 PASS x = class extends Base { constructor() { super(); } super() {} } 19 PASS x = class extends Base { constructor() { super(); } method() { super() } }:::SyntaxError: Cannot call super() outside of a class constructor.20 PASS x = class extends Base { constructor() { super(); } method() { super } }:::SyntaxError: Cannot reference super.19 PASS x = class extends Base { constructor() { super(); } method() { super() } }:::SyntaxError: super is not valid in this context. 20 PASS x = class extends Base { constructor() { super(); } method() { super } }:::SyntaxError: super is not valid in this context. 21 21 PASS x = class extends Base { constructor() { super(); } method() { return new super } }:::SyntaxError: Cannot use new with super. 22 22 PASS x = class extends Base { constructor() { super(); } method1() { delete (super.foo) } method2() { delete super["foo"] } } … … 38 38 PASS new (class extends null { constructor() { return 1; } }):::TypeError: Cannot return a non-object type in the constructor of a derived class. 39 39 PASS new (class extends null { constructor() { super() } }):::TypeError: function is not a constructor (evaluating 'super()') 40 PASS new (class { constructor() { super() } }):::SyntaxError: Cannot call super() in a base class constructor.41 PASS function x() { super(); }:::SyntaxError: Cannot call super() outside of a class constructor.42 PASS new (class extends Object { constructor() { function x() { super() } } }):::SyntaxError: Cannot call super() outside of a class constructor.43 PASS new (class extends Object { constructor() { function x() { super.method } } }):::SyntaxError: super can only be used in a method of a derived class.44 PASS function x() { super.method(); }:::SyntaxError: super can only be used in a method of a derived class.45 PASS function x() { super(); }:::SyntaxError: Cannot call super() outside of a class constructor.46 PASS eval("super.method()"):::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.47 PASS eval("super()"):::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.48 PASS (function () { eval("super.method()");})():::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.49 PASS (function () { eval("super()");})():::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.50 PASS new (class { constructor() { (function () { eval("super()");})(); } }):::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.51 PASS (new (class { method() { (function () { eval("super.method()");})(); }})).method():::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.40 PASS new (class { constructor() { super() } }):::SyntaxError: super is not valid in this context. 41 PASS function x() { super(); }:::SyntaxError: super is not valid in this context. 42 PASS new (class extends Object { constructor() { function x() { super() } } }):::SyntaxError: super is not valid in this context. 43 PASS new (class extends Object { constructor() { function x() { super.method } } }):::SyntaxError: super is not valid in this context. 44 PASS function x() { super.method(); }:::SyntaxError: super is not valid in this context. 45 PASS function x() { super(); }:::SyntaxError: super is not valid in this context. 46 PASS eval("super.method()"):::SyntaxError: super is not valid in this context. 47 PASS eval("super()"):::SyntaxError: super is not valid in this context. 48 PASS (function () { eval("super.method()");})():::SyntaxError: super is not valid in this context. 49 PASS (function () { eval("super()");})():::SyntaxError: super is not valid in this context. 50 PASS new (class { constructor() { (function () { eval("super()");})(); } }):::SyntaxError: super is not valid in this context. 51 PASS (new (class { method() { (function () { eval("super.method()");})(); }})).method():::SyntaxError: super is not valid in this context. 52 52 PASS successfullyParsed 53 53 -
trunk/LayoutTests/js/object-literal-methods-expected.txt
r181901 r199927 69 69 PASS ({__proto__(){}}) instanceof Function is false 70 70 PASS ({__proto__(){}}).__proto__ instanceof Function is true 71 PASS { f() { return super.f(); } }.f() threw exception SyntaxError: Unexpected token '{'. 72 PASS new ({ f() { return super(); }.f) threw exception SyntaxError: super is not valid in this context.. 73 PASS o = { f() { } }; new ({ __proto__: o, f() { return super(); } }).f threw exception SyntaxError: super is not valid in this context.. 74 PASS ({ f() { return (() => super.f())(); } }).f() threw exception TypeError: super.f is not a function. (In 'super.f()', 'super.f' is undefined). 75 PASS o = { f() { return true; } }; ({ __proto__: o, f() { return super.f(); } }).f() is true 76 PASS o = { get p() { return true; } }; ({ __proto__: o, get p() { return super.p; } }).p is true 77 PASS o = { set p(p2) { } }; ({ __proto__: o, set p(p2) { super.p = p2; } }).p = true is true 78 PASS o = { f() { return true; } }; ({ __proto__: o, f() { return (() => super.f())(); } }).f() is true 71 79 PASS successfullyParsed is true 72 80 -
trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js
r197554 r199927 49 49 shouldThrow('var arr3 = {c:b,d:a} => a + b;'); 50 50 51 shouldThrow('var arr4 = () => { super(); };', '"SyntaxError: Cannot call super() outside of a class constructor."');52 shouldThrow('var arr4 = () => { super; };', '"SyntaxError: Cannot reference super."');53 shouldThrow('var arr5 = () => { super.getValue(); };', '"SyntaxError: super can only be used in a method of a derived class."');51 shouldThrow('var arr4 = () => { super(); };', '"SyntaxError: super is not valid in this context."'); 52 shouldThrow('var arr4 = () => { super; };', '"SyntaxError: super is not valid in this context."'); 53 shouldThrow('var arr5 = () => { super.getValue(); };', '"SyntaxError: super is not valid in this context."'); 54 54 55 shouldThrow('var arr6 = () => super();', '"SyntaxError: Cannot call super() outside of a class constructor."');56 shouldThrow('var arr7 = () => super;', '"SyntaxError: Cannot reference super."');57 shouldThrow('var arr8 = () => super.getValue();', '"SyntaxError: super can only be used in a method of a derived class."');55 shouldThrow('var arr6 = () => super();', '"SyntaxError: super is not valid in this context."'); 56 shouldThrow('var arr7 = () => super;', '"SyntaxError: super is not valid in this context."'); 57 shouldThrow('var arr8 = () => super.getValue();', '"SyntaxError: super is not valid in this context."'); 58 58 59 shouldThrow('class A { constructor() { function a () { return () => { super(); };}}', '"SyntaxError: Cannot call super() outside of a class constructor."');60 shouldThrow('class B { constructor() { function b () { return () => { super; }; }; }}', '"SyntaxError: Cannot reference super."');61 shouldThrow('class C { constructor() { function c () { return () => { super.getValue(); };}}', '"SyntaxError: super can only be used in a method of a derived class."');59 shouldThrow('class A { constructor() { function a () { return () => { super(); };}}', '"SyntaxError: super is not valid in this context."'); 60 shouldThrow('class B { constructor() { function b () { return () => { super; }; }; }}', '"SyntaxError: super is not valid in this context."'); 61 shouldThrow('class C { constructor() { function c () { return () => { super.getValue(); };}}', '"SyntaxError: super is not valid in this context."'); 62 62 63 shouldThrow('class D { constructor() { function a () { return () => super(); }}', '"SyntaxError: Cannot call super() outside of a class constructor."');64 shouldThrow('class E { constructor() { function b () { return () => super; }; }}', '"SyntaxError: Cannot reference super."');65 shouldThrow('class F { constructor() { function c () { return () => super.getValue(); }}', '"SyntaxError: super can only be used in a method of a derived class."');66 shouldThrow('class G {}; class G2 extends G { getValue() { function c () { return () => super.getValue(); }}', '"SyntaxError: super can only be used in a method of a derived class."');67 shouldThrow('class H {}; class H2 extends H { method() { function *gen() { let arr = () => super.getValue(); arr(); } } }', '"SyntaxError: super can only be used in a method of a derived class."');63 shouldThrow('class D { constructor() { function a () { return () => super(); }}', '"SyntaxError: super is not valid in this context."'); 64 shouldThrow('class E { constructor() { function b () { return () => super; }; }}', '"SyntaxError: super is not valid in this context."'); 65 shouldThrow('class F { constructor() { function c () { return () => super.getValue(); }}', '"SyntaxError: super is not valid in this context."'); 66 shouldThrow('class G {}; class G2 extends G { getValue() { function c () { return () => super.getValue(); }}', '"SyntaxError: super is not valid in this context."'); 67 shouldThrow('class H {}; class H2 extends H { method() { function *gen() { let arr = () => super.getValue(); arr(); } } }', '"SyntaxError: super is not valid in this context."'); 68 68 69 69 var successfullyParsed = true; -
trunk/LayoutTests/js/script-tests/class-syntax-super.js
r199724 r199927 100 100 shouldNotThrow('x = class extends Base { constructor() { super(); } super() {} }'); 101 101 shouldThrow('x = class extends Base { constructor() { super(); } method() { super() } }', 102 '"SyntaxError: Cannot call super() outside of a class constructor."');103 shouldThrow('x = class extends Base { constructor() { super(); } method() { super } }', '"SyntaxError: Cannot reference super."');102 '"SyntaxError: super is not valid in this context."'); 103 shouldThrow('x = class extends Base { constructor() { super(); } method() { super } }', '"SyntaxError: super is not valid in this context."'); 104 104 shouldThrow('x = class extends Base { constructor() { super(); } method() { return new super } }', '"SyntaxError: Cannot use new with super."'); 105 105 shouldNotThrow('x = class extends Base { constructor() { super(); } method1() { delete (super.foo) } method2() { delete super["foo"] } }'); … … 121 121 shouldThrow('new (class extends null { constructor() { return 1; } })', '"TypeError: Cannot return a non-object type in the constructor of a derived class."'); 122 122 shouldThrow('new (class extends null { constructor() { super() } })', '"TypeError: function is not a constructor (evaluating \'super()\')"'); 123 shouldThrow('new (class { constructor() { super() } })', '"SyntaxError: Cannot call super() in a base class constructor."');124 shouldThrow('function x() { super(); }', '"SyntaxError: Cannot call super() outside of a class constructor."');125 shouldThrow('new (class extends Object { constructor() { function x() { super() } } })', '"SyntaxError: Cannot call super() outside of a class constructor."');126 shouldThrow('new (class extends Object { constructor() { function x() { super.method } } })', '"SyntaxError: super can only be used in a method of a derived class."');127 shouldThrow('function x() { super.method(); }', '"SyntaxError: super can only be used in a method of a derived class."');128 shouldThrow('function x() { super(); }', '"SyntaxError: Cannot call super() outside of a class constructor."');129 shouldThrow('eval("super.method()")', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');130 shouldThrow('eval("super()")', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');123 shouldThrow('new (class { constructor() { super() } })', '"SyntaxError: super is not valid in this context."'); 124 shouldThrow('function x() { super(); }', '"SyntaxError: super is not valid in this context."'); 125 shouldThrow('new (class extends Object { constructor() { function x() { super() } } })', '"SyntaxError: super is not valid in this context."'); 126 shouldThrow('new (class extends Object { constructor() { function x() { super.method } } })', '"SyntaxError: super is not valid in this context."'); 127 shouldThrow('function x() { super.method(); }', '"SyntaxError: super is not valid in this context."'); 128 shouldThrow('function x() { super(); }', '"SyntaxError: super is not valid in this context."'); 129 shouldThrow('eval("super.method()")', '"SyntaxError: super is not valid in this context."'); 130 shouldThrow('eval("super()")', '"SyntaxError: super is not valid in this context."'); 131 131 132 shouldThrow('(function () { eval("super.method()");})()', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');133 shouldThrow('(function () { eval("super()");})()', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');132 shouldThrow('(function () { eval("super.method()");})()', '"SyntaxError: super is not valid in this context."'); 133 shouldThrow('(function () { eval("super()");})()', '"SyntaxError: super is not valid in this context."'); 134 134 135 shouldThrow('new (class { constructor() { (function () { eval("super()");})(); } })', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');136 shouldThrow('(new (class { method() { (function () { eval("super.method()");})(); }})).method()', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');135 shouldThrow('new (class { constructor() { (function () { eval("super()");})(); } })', '"SyntaxError: super is not valid in this context."'); 136 shouldThrow('(new (class { method() { (function () { eval("super.method()");})(); }})).method()', '"SyntaxError: super is not valid in this context."'); 137 137 138 138 var successfullyParsed = true; -
trunk/LayoutTests/js/script-tests/object-literal-methods.js
r181183 r199927 83 83 shouldBeFalse("({__proto__(){}}) instanceof Function"); 84 84 shouldBeTrue("({__proto__(){}}).__proto__ instanceof Function"); 85 86 shouldThrow("{ f() { return super.f(); } }.f()"); 87 shouldThrow("new ({ f() { return super(); }.f)"); 88 shouldThrow("o = { f() { } }; new ({ __proto__: o, f() { return super(); } }).f"); 89 shouldThrow("({ f() { return (() => super.f())(); } }).f()"); 90 shouldBeTrue("o = { f() { return true; } }; ({ __proto__: o, f() { return super.f(); } }).f()"); 91 shouldBeTrue("o = { get p() { return true; } }; ({ __proto__: o, get p() { return super.p; } }).p"); 92 shouldBeTrue("o = { set p(p2) { } }; ({ __proto__: o, set p(p2) { super.p = p2; } }).p = true"); 93 shouldBeTrue("o = { f() { return true; } }; ({ __proto__: o, f() { return (() => super.f())(); } }).f()"); -
trunk/LayoutTests/sputnik/Conformance/07_Lexical_Conventions/7.5_Tokens/7.5.3_Future_Reserved_Words/S7.5.3_A1.27-expected.txt
r198472 r199927 1 CONSOLE MESSAGE: line 76: SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.1 CONSOLE MESSAGE: line 76: SyntaxError: super is not valid in this context. 2 2 S7.5.3_A1.27 3 3 -
trunk/Source/JavaScriptCore/ChangeLog
r199918 r199927 1 2016-04-22 Geoffrey Garen <ggaren@apple.com> 2 3 super should be available in object literals 4 https://bugs.webkit.org/show_bug.cgi?id=156933 5 6 Reviewed by Saam Barati. 7 8 When we originally implemented classes, super seemed to be a class-only 9 feature. But the final spec says it's available in object literals too. 10 11 * bytecompiler/NodesCodegen.cpp: 12 (JSC::PropertyListNode::emitBytecode): Having 'super' and being a class 13 property are no longer synonymous, so we track two separate variables. 14 15 (JSC::PropertyListNode::emitPutConstantProperty): Being inside the super 16 branch no longer guarantees that you're a class property, so we decide 17 our attributes and our function name dynamically. 18 19 * parser/ASTBuilder.h: 20 (JSC::ASTBuilder::createArrowFunctionExpr): 21 (JSC::ASTBuilder::createGetterOrSetterProperty): 22 (JSC::ASTBuilder::createArguments): 23 (JSC::ASTBuilder::createArgumentsList): 24 (JSC::ASTBuilder::createProperty): 25 (JSC::ASTBuilder::createPropertyList): Pass through state to indicate 26 whether we're a class property, since we can't infer it from 'super' 27 anymore. 28 29 * parser/NodeConstructors.h: 30 (JSC::PropertyNode::PropertyNode): See ASTBuilder.h. 31 32 * parser/Nodes.h: 33 (JSC::PropertyNode::expressionName): 34 (JSC::PropertyNode::name): 35 (JSC::PropertyNode::type): 36 (JSC::PropertyNode::needsSuperBinding): 37 (JSC::PropertyNode::isClassProperty): 38 (JSC::PropertyNode::putType): See ASTBuilder.h. 39 40 * parser/Parser.cpp: 41 (JSC::Parser<LexerType>::parseFunctionInfo): 42 (JSC::Parser<LexerType>::parseClass): 43 (JSC::Parser<LexerType>::parseProperty): 44 (JSC::Parser<LexerType>::parsePropertyMethod): 45 (JSC::Parser<LexerType>::parseGetterSetter): 46 (JSC::Parser<LexerType>::parseMemberExpression): I made these error 47 messages generic because it is no longer practical to say concise things 48 about the list of places you can use super. 49 50 * parser/Parser.h: 51 52 * parser/SyntaxChecker.h: 53 (JSC::SyntaxChecker::createArgumentsList): 54 (JSC::SyntaxChecker::createProperty): 55 (JSC::SyntaxChecker::appendExportSpecifier): 56 (JSC::SyntaxChecker::appendConstDecl): 57 (JSC::SyntaxChecker::createGetterOrSetterProperty): Updated for 58 interface change. 59 60 * tests/stress/generator-with-super.js: 61 (test): 62 * tests/stress/modules-syntax-error.js: 63 * tests/stress/super-in-lexical-scope.js: 64 (testSyntaxError): 65 (testSyntaxError.test): 66 * tests/stress/tagged-templates-syntax.js: Updated for error message 67 changes. See Parser.cpp. 68 1 69 2016-04-22 Filip Pizlo <fpizlo@apple.com> 2 70 -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r199724 r199927 499 499 500 500 RefPtr<RegisterID> value = generator.emitNode(node->m_assign); 501 bool isClassProperty= node->needsSuperBinding();502 if ( isClassProperty)501 bool needsSuperBinding = node->needsSuperBinding(); 502 if (needsSuperBinding) 503 503 emitPutHomeObject(generator, value.get(), dst); 504 unsigned attribute = isClassProperty ? (Accessor | DontEnum) : Accessor; 504 505 unsigned attributes = node->isClassProperty() ? (Accessor | DontEnum) : Accessor; 505 506 506 507 ASSERT(node->m_type & (PropertyNode::Getter | PropertyNode::Setter)); … … 513 514 generator.emitSetFunctionNameIfNeeded(node->m_assign, value.get(), propertyName.get()); 514 515 if (node->m_type & PropertyNode::Getter) 515 generator.emitPutGetterByVal(dst, propertyName.get(), attribute , value.get());516 generator.emitPutGetterByVal(dst, propertyName.get(), attributes, value.get()); 516 517 else 517 generator.emitPutSetterByVal(dst, propertyName.get(), attribute , value.get());518 generator.emitPutSetterByVal(dst, propertyName.get(), attributes, value.get()); 518 519 continue; 519 520 } 520 521 521 522 if (node->m_type & PropertyNode::Getter) 522 generator.emitPutGetterById(dst, *node->name(), attribute , value.get());523 generator.emitPutGetterById(dst, *node->name(), attributes, value.get()); 523 524 else 524 generator.emitPutSetterById(dst, *node->name(), attribute , value.get());525 generator.emitPutSetterById(dst, *node->name(), attributes, value.get()); 525 526 continue; 526 527 } … … 563 564 } 564 565 565 ASSERT(!pair.second || isClassProperty== pair.second->needsSuperBinding());566 if ( isClassProperty&& pair.second)566 ASSERT(!pair.second || needsSuperBinding == pair.second->needsSuperBinding()); 567 if (needsSuperBinding && pair.second) 567 568 emitPutHomeObject(generator, secondReg, dst); 568 569 569 generator.emitPutGetterSetter(dst, *node->name(), attribute , getterReg.get(), setterReg.get());570 generator.emitPutGetterSetter(dst, *node->name(), attributes, getterReg.get(), setterReg.get()); 570 571 } 571 572 } … … 586 587 propertyNameRegister = generator.emitNode(node.m_expression); 587 588 589 unsigned attributes = BytecodeGenerator::PropertyConfigurable | BytecodeGenerator::PropertyWritable; 590 if (!node.isClassProperty()) 591 attributes |= BytecodeGenerator::PropertyEnumerable; 592 generator.emitSetFunctionNameIfNeeded(node.m_assign, value.get(), propertyNameRegister.get()); 588 593 generator.emitCallDefineProperty(newObj, propertyNameRegister.get(), 589 value.get(), nullptr, nullptr, BytecodeGenerator::PropertyConfigurable | BytecodeGenerator::PropertyWritable, m_position);594 value.get(), nullptr, nullptr, attributes, m_position); 590 595 return; 591 596 } -
trunk/Source/JavaScriptCore/parser/ASTBuilder.h
r198332 r199927 411 411 412 412 NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, bool, 413 const Identifier* name, const ParserFunctionInfo<ASTBuilder>& functionInfo, SuperBinding superBinding)413 const Identifier* name, const ParserFunctionInfo<ASTBuilder>& functionInfo, bool isClassProperty) 414 414 { 415 415 ASSERT(name); … … 419 419 SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn); 420 420 MethodDefinitionNode* methodDef = new (m_parserArena) MethodDefinitionNode(location, m_vm->propertyNames->nullIdentifier, functionInfo.body, source); 421 return new (m_parserArena) PropertyNode(*name, methodDef, type, PropertyNode::Unknown, superBinding);421 return new (m_parserArena) PropertyNode(*name, methodDef, type, PropertyNode::Unknown, SuperBinding::Needed, isClassProperty); 422 422 } 423 423 424 424 NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, bool, 425 ExpressionNode* name, const ParserFunctionInfo<ASTBuilder>& functionInfo, SuperBinding superBinding)425 ExpressionNode* name, const ParserFunctionInfo<ASTBuilder>& functionInfo, bool isClassProperty) 426 426 { 427 427 ASSERT(name); … … 429 429 SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn); 430 430 MethodDefinitionNode* methodDef = new (m_parserArena) MethodDefinitionNode(location, m_vm->propertyNames->nullIdentifier, functionInfo.body, source); 431 return new (m_parserArena) PropertyNode(name, methodDef, type, PropertyNode::Unknown, superBinding);431 return new (m_parserArena) PropertyNode(name, methodDef, type, PropertyNode::Unknown, SuperBinding::Needed, isClassProperty); 432 432 } 433 433 434 434 NEVER_INLINE PropertyNode* createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation& location, PropertyNode::Type type, bool, 435 double name, const ParserFunctionInfo<ASTBuilder>& functionInfo, SuperBinding superBinding)435 double name, const ParserFunctionInfo<ASTBuilder>& functionInfo, bool isClassProperty) 436 436 { 437 437 functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset); … … 439 439 SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn); 440 440 MethodDefinitionNode* methodDef = new (m_parserArena) MethodDefinitionNode(location, vm->propertyNames->nullIdentifier, functionInfo.body, source); 441 return new (m_parserArena) PropertyNode(ident, methodDef, type, PropertyNode::Unknown, superBinding);441 return new (m_parserArena) PropertyNode(ident, methodDef, type, PropertyNode::Unknown, SuperBinding::Needed, isClassProperty); 442 442 } 443 443 … … 447 447 ArgumentListNode* createArgumentsList(const JSTokenLocation& location, ArgumentListNode* args, ExpressionNode* arg) { return new (m_parserArena) ArgumentListNode(location, args, arg); } 448 448 449 PropertyNode* createProperty(const Identifier* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding = SuperBinding::NotNeeded)449 PropertyNode* createProperty(const Identifier* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding, bool isClassProperty) 450 450 { 451 451 if (node->isFuncExprNode()) { … … 455 455 } else if (node->isClassExprNode()) 456 456 static_cast<ClassExprNode*>(node)->setEcmaName(*propertyName); 457 return new (m_parserArena) PropertyNode(*propertyName, node, type, putType, superBinding );458 } 459 PropertyNode* createProperty(VM* vm, ParserArena& parserArena, double propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool )460 { 461 return new (m_parserArena) PropertyNode(parserArena.identifierArena().makeNumericIdentifier(vm, propertyName), node, type, putType );462 } 463 PropertyNode* createProperty(ExpressionNode* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding = SuperBinding::NotNeeded) { return new (m_parserArena) PropertyNode(propertyName, node, type, putType, superBinding); }457 return new (m_parserArena) PropertyNode(*propertyName, node, type, putType, superBinding, isClassProperty); 458 } 459 PropertyNode* createProperty(VM* vm, ParserArena& parserArena, double propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding, bool isClassProperty) 460 { 461 return new (m_parserArena) PropertyNode(parserArena.identifierArena().makeNumericIdentifier(vm, propertyName), node, type, putType, superBinding, isClassProperty); 462 } 463 PropertyNode* createProperty(ExpressionNode* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding, bool isClassProperty) { return new (m_parserArena) PropertyNode(propertyName, node, type, putType, superBinding, isClassProperty); } 464 464 PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property) { return new (m_parserArena) PropertyListNode(location, property); } 465 465 PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property, PropertyListNode* tail) { return new (m_parserArena) PropertyListNode(location, property, tail); } -
trunk/Source/JavaScriptCore/parser/NodeConstructors.h
r198349 r199927 221 221 } 222 222 223 inline PropertyNode::PropertyNode(const Identifier& name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding = SuperBinding::NotNeeded)223 inline PropertyNode::PropertyNode(const Identifier& name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding, bool isClassProperty) 224 224 : m_name(&name) 225 225 , m_assign(assign) … … 227 227 , m_needsSuperBinding(superBinding == SuperBinding::Needed) 228 228 , m_putType(putType) 229 { 230 } 231 232 inline PropertyNode::PropertyNode(ExpressionNode* name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding = SuperBinding::NotNeeded) 229 , m_isClassProperty(isClassProperty) 230 { 231 } 232 233 inline PropertyNode::PropertyNode(ExpressionNode* name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding, bool isClassProperty) 233 234 : m_name(0) 234 235 , m_expression(name) … … 237 238 , m_needsSuperBinding(superBinding == SuperBinding::Needed) 238 239 , m_putType(putType) 240 , m_isClassProperty(isClassProperty) 239 241 { 240 242 } -
trunk/Source/JavaScriptCore/parser/Nodes.h
r199768 r199927 627 627 enum PutType { Unknown, KnownDirect }; 628 628 629 PropertyNode(const Identifier&, ExpressionNode*, Type, PutType, SuperBinding );630 PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type, PutType, SuperBinding );629 PropertyNode(const Identifier&, ExpressionNode*, Type, PutType, SuperBinding, bool isClassProperty); 630 PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type, PutType, SuperBinding, bool isClassProperty); 631 631 632 632 ExpressionNode* expressionName() const { return m_expression; } … … 635 635 Type type() const { return static_cast<Type>(m_type); } 636 636 bool needsSuperBinding() const { return m_needsSuperBinding; } 637 bool isClassProperty() const { return m_isClassProperty; } 637 638 PutType putType() const { return static_cast<PutType>(m_putType); } 638 639 … … 645 646 unsigned m_needsSuperBinding : 1; 646 647 unsigned m_putType : 1; 648 unsigned m_isClassProperty: 1; 647 649 }; 648 650 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r199845 r199927 2079 2079 functionScope->setStrictMode(); 2080 2080 2081 semanticFailIfTrue(generatorBodyScope->hasDirectSuper(), " Cannot call super() outside of a class constructor");2081 semanticFailIfTrue(generatorBodyScope->hasDirectSuper(), "super is not valid in this context"); 2082 2082 if (generatorBodyScope->needsSuperBinding()) 2083 semanticFailIfTrue(expectedSuperBinding == SuperBinding::NotNeeded, "super can only be used in a method of a derived class");2083 semanticFailIfTrue(expectedSuperBinding == SuperBinding::NotNeeded, "super is not valid in this context"); 2084 2084 2085 2085 popScope(generatorBodyScope, TreeBuilder::NeedsFreeVariableInfo); … … 2104 2104 ? constructorKind 2105 2105 : scopeRef->constructorKind(); 2106 semanticFailIfTrue(functionConstructorKind == ConstructorKind::None, " Cannot call super() outside of a class constructor");2107 semanticFailIfTrue(functionConstructorKind != ConstructorKind::Derived, " Cannot call super() in a base class constructor");2106 semanticFailIfTrue(functionConstructorKind == ConstructorKind::None, "super is not valid in this context"); 2107 semanticFailIfTrue(functionConstructorKind != ConstructorKind::Derived, "super is not valid in this context"); 2108 2108 } 2109 2109 if (functionScope->needsSuperBinding()) { … … 2112 2112 ? expectedSuperBinding 2113 2113 : scopeRef->expectedSuperBinding(); 2114 semanticFailIfTrue(functionSuperBinding == SuperBinding::NotNeeded, "super can only be used in a method of a derived class");2114 semanticFailIfTrue(functionSuperBinding == SuperBinding::NotNeeded, "super is not valid in this context"); 2115 2115 } 2116 2116 } … … 2336 2336 const bool alwaysStrictInsideClass = true; 2337 2337 if (isGetter || isSetter) { 2338 bool isClassProperty = true; 2338 2339 property = parseGetterSetter(context, alwaysStrictInsideClass, isGetter ? PropertyNode::Getter : PropertyNode::Setter, methodStart, 2339 ConstructorKind::None, SuperBinding::Needed);2340 ConstructorKind::None, isClassProperty); 2340 2341 failIfFalse(property, "Cannot parse this method"); 2341 2342 } else { … … 2362 2363 semanticFailIfTrue(isStaticMethod && methodInfo.name && *methodInfo.name == propertyNames.prototype, 2363 2364 "Cannot declare a static method named 'prototype'"); 2365 2366 bool isClassProperty = true; 2364 2367 if (computedPropertyName) { 2365 2368 property = context.createProperty(computedPropertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), 2366 PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed );2369 PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed, isClassProperty); 2367 2370 } else 2368 property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed );2371 property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed, isClassProperty); 2369 2372 } 2370 2373 … … 3258 3261 bool wasIdent = false; 3259 3262 bool isGenerator = false; 3263 bool isClassProperty = false; 3260 3264 #if ENABLE(ES6_GENERATORS) 3261 3265 if (consume(TIMES)) … … 3280 3284 failIfFalse(node, "Cannot parse expression for property declaration"); 3281 3285 context.setEndOffset(node, m_lexer->currentOffset()); 3282 return context.createProperty(ident, node, PropertyNode::Constant, PropertyNode::Unknown, complete );3286 return context.createProperty(ident, node, PropertyNode::Constant, PropertyNode::Unknown, complete, SuperBinding::NotNeeded, isClassProperty); 3283 3287 } 3284 3288 … … 3286 3290 auto method = parsePropertyMethod(context, ident, isGenerator); 3287 3291 propagateError(); 3288 return context.createProperty(ident, method, PropertyNode::Constant, PropertyNode::KnownDirect, complete );3292 return context.createProperty(ident, method, PropertyNode::Constant, PropertyNode::KnownDirect, complete, SuperBinding::Needed, isClassProperty); 3289 3293 } 3290 3294 failIfTrue(isGenerator, "Expected a parenthesis for argument list"); … … 3299 3303 currentScope()->setInnerArrowFunctionUsesEval(); 3300 3304 TreeExpression node = context.createResolve(location, *ident, start, lastTokenEndPosition()); 3301 return context.createProperty(ident, node, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Shorthand), PropertyNode::KnownDirect, complete );3305 return context.createProperty(ident, node, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Shorthand), PropertyNode::KnownDirect, complete, SuperBinding::NotNeeded, isClassProperty); 3302 3306 } 3303 3307 … … 3312 3316 else 3313 3317 failWithMessage("Expected a ':' following the property name '", ident->impl(), "'"); 3314 return parseGetterSetter(context, complete, type, getterOrSetterStartOffset );3318 return parseGetterSetter(context, complete, type, getterOrSetterStartOffset, ConstructorKind::None, isClassProperty); 3315 3319 } 3316 3320 case DOUBLE: … … 3323 3327 auto method = parsePropertyMethod(context, &ident, isGenerator); 3324 3328 propagateError(); 3325 return context.createProperty(&ident, method, PropertyNode::Constant, PropertyNode::Unknown, complete );3329 return context.createProperty(&ident, method, PropertyNode::Constant, PropertyNode::Unknown, complete, SuperBinding::Needed, isClassProperty); 3326 3330 } 3327 3331 failIfTrue(isGenerator, "Expected a parenthesis for argument list"); … … 3331 3335 failIfFalse(node, "Cannot parse expression for property declaration"); 3332 3336 context.setEndOffset(node, m_lexer->currentOffset()); 3333 return context.createProperty(const_cast<VM*>(m_vm), m_parserArena, propertyName, node, PropertyNode::Constant, PropertyNode::Unknown, complete );3337 return context.createProperty(const_cast<VM*>(m_vm), m_parserArena, propertyName, node, PropertyNode::Constant, PropertyNode::Unknown, complete, SuperBinding::NotNeeded, isClassProperty); 3334 3338 } 3335 3339 case OPENBRACKET: { … … 3342 3346 auto method = parsePropertyMethod(context, &m_vm->propertyNames->nullIdentifier, isGenerator); 3343 3347 propagateError(); 3344 return context.createProperty(propertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::KnownDirect, complete );3348 return context.createProperty(propertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::KnownDirect, complete, SuperBinding::Needed, isClassProperty); 3345 3349 } 3346 3350 failIfTrue(isGenerator, "Expected a parenthesis for argument list"); … … 3350 3354 failIfFalse(node, "Cannot parse expression for property declaration"); 3351 3355 context.setEndOffset(node, m_lexer->currentOffset()); 3352 return context.createProperty(propertyName, node, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::Unknown, complete );3356 return context.createProperty(propertyName, node, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::Unknown, complete, SuperBinding::NotNeeded, isClassProperty); 3353 3357 } 3354 3358 default: … … 3365 3369 ParserFunctionInfo<TreeBuilder> methodInfo; 3366 3370 SourceParseMode parseMode = isGenerator ? SourceParseMode::GeneratorWrapperFunctionMode : SourceParseMode::MethodMode; 3367 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, parseMode, false, ConstructorKind::None, SuperBinding::N otNeeded, methodStart, methodInfo, FunctionDefinitionType::Method)), "Cannot parse this method");3371 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, parseMode, false, ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, FunctionDefinitionType::Method)), "Cannot parse this method"); 3368 3372 methodInfo.name = methodName; 3369 3373 return context.createMethodDefinition(methodLocation, methodInfo); … … 3372 3376 template <typename LexerType> 3373 3377 template <class TreeBuilder> TreeProperty Parser<LexerType>::parseGetterSetter(TreeBuilder& context, bool strict, PropertyNode::Type type, unsigned getterOrSetterStartOffset, 3374 ConstructorKind constructorKind, SuperBinding superBinding)3378 ConstructorKind constructorKind, bool isClassProperty) 3375 3379 { 3376 3380 const Identifier* stringPropertyName = 0; … … 3382 3386 if (matchSpecIdentifier() || match(STRING) || m_token.m_type & KeywordTokenFlag) { 3383 3387 stringPropertyName = m_token.m_data.ident; 3384 semanticFailIfTrue( superBinding == SuperBinding::Needed&& *stringPropertyName == m_vm->propertyNames->prototype,3388 semanticFailIfTrue(isClassProperty && *stringPropertyName == m_vm->propertyNames->prototype, 3385 3389 "Cannot declare a static method named 'prototype'"); 3386 semanticFailIfTrue( superBinding == SuperBinding::Needed&& *stringPropertyName == m_vm->propertyNames->constructor,3390 semanticFailIfTrue(isClassProperty && *stringPropertyName == m_vm->propertyNames->constructor, 3387 3391 "Cannot declare a getter or setter named 'constructor'"); 3388 3392 next(); … … 3401 3405 if (type & PropertyNode::Getter) { 3402 3406 failIfFalse(match(OPENPAREN), "Expected a parameter list for getter definition"); 3403 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::GetterMode, false, constructorKind, superBinding, getterOrSetterStartOffset, info, FunctionDefinitionType::Method)), "Cannot parse getter definition");3407 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::GetterMode, false, constructorKind, SuperBinding::Needed, getterOrSetterStartOffset, info, FunctionDefinitionType::Method)), "Cannot parse getter definition"); 3404 3408 } else { 3405 3409 failIfFalse(match(OPENPAREN), "Expected a parameter list for setter definition"); 3406 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::SetterMode, false, constructorKind, superBinding, getterOrSetterStartOffset, info, FunctionDefinitionType::Method)), "Cannot parse setter definition");3410 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::SetterMode, false, constructorKind, SuperBinding::Needed, getterOrSetterStartOffset, info, FunctionDefinitionType::Method)), "Cannot parse setter definition"); 3407 3411 } 3408 3412 3409 3413 if (stringPropertyName) 3410 return context.createGetterOrSetterProperty(location, type, strict, stringPropertyName, info, superBinding);3414 return context.createGetterOrSetterProperty(location, type, strict, stringPropertyName, info, isClassProperty); 3411 3415 3412 3416 if (computedPropertyName) 3413 return context.createGetterOrSetterProperty(location, static_cast<PropertyNode::Type>(type | PropertyNode::Computed), strict, computedPropertyName, info, superBinding);3414 3415 return context.createGetterOrSetterProperty(const_cast<VM*>(m_vm), m_parserArena, location, type, strict, numericPropertyName, info, superBinding);3417 return context.createGetterOrSetterProperty(location, static_cast<PropertyNode::Type>(type | PropertyNode::Computed), strict, computedPropertyName, info, isClassProperty); 3418 3419 return context.createGetterOrSetterProperty(const_cast<VM*>(m_vm), m_parserArena, location, type, strict, numericPropertyName, info, isClassProperty); 3416 3420 } 3417 3421 … … 3895 3899 if (baseIsSuper) { 3896 3900 ScopeRef scopeRef = closestParentOrdinaryFunctionNonLexicalScope(); 3897 semanticFailIfFalse(currentScope()->isFunction() || (scopeRef->isEvalContext() && scopeRef->expectedSuperBinding() == SuperBinding::Needed), " 'super' is only valid inside a function or an 'eval' inside a function");3901 semanticFailIfFalse(currentScope()->isFunction() || (scopeRef->isEvalContext() && scopeRef->expectedSuperBinding() == SuperBinding::Needed), "super is not valid in this context"); 3898 3902 base = context.createSuperExpr(location); 3899 3903 next(); … … 3973 3977 } 3974 3978 endMemberExpression: 3975 semanticFailIfTrue(baseIsSuper, " Cannot reference super");3979 semanticFailIfTrue(baseIsSuper, "super is not valid in this context"); 3976 3980 while (newCount--) 3977 3981 base = context.createNewExpr(location, base, expressionStart, lastTokenEndPosition()); -
trunk/Source/JavaScriptCore/parser/Parser.h
r199845 r199927 1389 1389 template <class TreeBuilder> TreeProperty parseProperty(TreeBuilder&, bool strict); 1390 1390 template <class TreeBuilder> TreeExpression parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator); 1391 template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind = ConstructorKind::None, SuperBinding = SuperBinding::NotNeeded);1391 template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind, bool isClassProperty); 1392 1392 template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, const JSTokenLocation&, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, SuperBinding, FunctionBodyType, unsigned, SourceParseMode); 1393 1393 template <class TreeBuilder> ALWAYS_INLINE bool parseFormalParameters(TreeBuilder&, TreeFormalParameterList, unsigned&); -
trunk/Source/JavaScriptCore/parser/SyntaxChecker.h
r199787 r199927 203 203 int createArgumentsList(const JSTokenLocation&, int) { return ArgumentsListResult; } 204 204 int createArgumentsList(const JSTokenLocation&, int, int) { return ArgumentsListResult; } 205 Property createProperty(const Identifier* name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete, SuperBinding = SuperBinding::NotNeeded)205 Property createProperty(const Identifier* name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete, SuperBinding, bool) 206 206 { 207 207 if (!complete) … … 210 210 return Property(name, type); 211 211 } 212 Property createProperty(VM* vm, ParserArena& parserArena, double name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete )212 Property createProperty(VM* vm, ParserArena& parserArena, double name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete, SuperBinding, bool) 213 213 { 214 214 if (!complete) … … 216 216 return Property(&parserArena.identifierArena().makeNumericIdentifier(vm, name), type); 217 217 } 218 Property createProperty(int, int, PropertyNode::Type type, PropertyNode::PutType, bool, SuperBinding = SuperBinding::NotNeeded)218 Property createProperty(int, int, PropertyNode::Type type, PropertyNode::PutType, bool, SuperBinding, bool) 219 219 { 220 220 return Property(type); … … 270 270 271 271 int appendConstDecl(const JSTokenLocation&, int, const Identifier*, int) { return StatementResult; } 272 Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool strict, const Identifier* name, const ParserFunctionInfo<SyntaxChecker>&, SuperBinding)272 Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool strict, const Identifier* name, const ParserFunctionInfo<SyntaxChecker>&, bool) 273 273 { 274 274 ASSERT(name); … … 277 277 return Property(name, type); 278 278 } 279 Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool, int, const ParserFunctionInfo<SyntaxChecker>&, SuperBinding)279 Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool, int, const ParserFunctionInfo<SyntaxChecker>&, bool) 280 280 { 281 281 return Property(type); 282 282 } 283 Property createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation&, PropertyNode::Type type, bool strict, double name, const ParserFunctionInfo<SyntaxChecker>&, SuperBinding)283 Property createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation&, PropertyNode::Type type, bool strict, double name, const ParserFunctionInfo<SyntaxChecker>&, bool) 284 284 { 285 285 if (!strict) -
trunk/Source/JavaScriptCore/tests/stress/generator-with-super.js
r198472 r199927 24 24 } 25 25 26 shouldThrow(() => test(), "SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.");26 shouldThrow(() => test(), "SyntaxError: super is not valid in this context."); 27 27 }()); 28 28 -
trunk/Source/JavaScriptCore/tests/stress/modules-syntax-error.js
r198472 r199927 308 308 checkModuleSyntaxError(String.raw` 309 309 super(); 310 `, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.:2`);310 `, `SyntaxError: super is not valid in this context.:2`); 311 311 312 312 checkModuleSyntaxError(String.raw` 313 313 super.test(); 314 `, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.:2`);314 `, `SyntaxError: super is not valid in this context.:2`); 315 315 316 316 checkModuleSyntaxError(String.raw` 317 317 super.test = 20; 318 `, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.:2`);318 `, `SyntaxError: super is not valid in this context.:2`); -
trunk/Source/JavaScriptCore/tests/stress/super-in-lexical-scope.js
r198472 r199927 19 19 20 20 if (String(error) !== message) 21 throw new Error("Bad error: " + String(error) );21 throw new Error("Bad error: " + String(error) + "(Expected: " + message + ")"); 22 22 } 23 23 24 testSyntaxError(`super()`, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.`);25 testSyntaxError(`super.hello()`, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.`);24 testSyntaxError(`super()`, `SyntaxError: super is not valid in this context.`); 25 testSyntaxError(`super.hello()`, `SyntaxError: super is not valid in this context.`); 26 26 testSyntaxError(` 27 27 { 28 28 super(); 29 29 } 30 `, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.`);30 `, `SyntaxError: super is not valid in this context.`); 31 31 testSyntaxError(` 32 32 { 33 33 super.hello(); 34 34 } 35 `, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.`);35 `, `SyntaxError: super is not valid in this context.`); 36 36 testSyntaxError(` 37 37 function test() … … 39 39 super(); 40 40 } 41 `, `SyntaxError: Cannot call super() outside of a class constructor.`);41 `, `SyntaxError: super is not valid in this context.`); 42 42 testSyntaxError(` 43 43 function test() … … 45 45 super.hello(); 46 46 } 47 `, `SyntaxError: super can only be used in a method of a derived class.`);47 `, `SyntaxError: super is not valid in this context.`); 48 48 testSyntaxError(` 49 49 function test() … … 53 53 } 54 54 } 55 `, `SyntaxError: Cannot call super() outside of a class constructor.`);55 `, `SyntaxError: super is not valid in this context.`); 56 56 testSyntaxError(` 57 57 function test() … … 61 61 } 62 62 } 63 `, `SyntaxError: super can only be used in a method of a derived class.`);63 `, `SyntaxError: super is not valid in this context.`); -
trunk/Source/JavaScriptCore/tests/stress/tagged-templates-syntax.js
r198472 r199927 67 67 testSyntax("(class extends Hello { constructor() { super()`${tag}${tag}` } })"); 68 68 69 testSyntaxError("super`Hello${tag}`", "SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.");69 testSyntaxError("super`Hello${tag}`", "SyntaxError: super is not valid in this context."); 70 70 testSyntaxError("(class { say() { super`Hello${tag}` } })", "SyntaxError: Cannot use super as tag for tagged templates.");
Note: See TracChangeset
for help on using the changeset viewer.