Changeset 183757 in webkit
- Timestamp:
- May 4, 2015 12:21:28 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r183756 r183757 1 2015-05-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 new super should be a syntax error 4 https://bugs.webkit.org/show_bug.cgi?id=144282 5 6 Reviewed by Joseph Pecoraro. 7 8 Rebaselined the test. 9 10 * js/class-syntax-super-expected.txt: 11 * js/script-tests/class-syntax-super.js: 12 1 13 2015-05-04 Simon Fraser <simon.fraser@apple.com> 2 14 -
trunk/LayoutTests/js/class-syntax-super-expected.txt
r183709 r183757 17 17 PASS x = class extends Base { constructor() { super(); } method() { super() } } threw exception SyntaxError: Cannot call super() outside of a class constructor.. 18 18 PASS x = class extends Base { constructor() { super(); } method() { super } } threw exception SyntaxError: Cannot reference super.. 19 PASS x = class extends Base { constructor() { super(); } method() { return new super } } did not throw exception. 20 PASS (new x).method() instanceof Base is true 21 PASS (new x).method() instanceof x is false 19 PASS x = class extends Base { constructor() { super(); } method() { return new super } } threw exception SyntaxError: Cannot use new with super.. 22 20 PASS x = class extends Base { constructor() { super(); } method1() { delete (super.foo) } method2() { delete super["foo"] } } did not throw exception. 23 21 PASS (new x).method1() threw exception ReferenceError: Cannot delete a super property. -
trunk/LayoutTests/js/script-tests/class-syntax-super.js
r183709 r183757 42 42 '"SyntaxError: Cannot call super() outside of a class constructor."'); 43 43 shouldThrow('x = class extends Base { constructor() { super(); } method() { super } }', '"SyntaxError: Cannot reference super."'); 44 shouldNotThrow('x = class extends Base { constructor() { super(); } method() { return new super } }'); 45 shouldBeTrue('(new x).method() instanceof Base'); 46 shouldBeFalse('(new x).method() instanceof x'); 44 shouldThrow('x = class extends Base { constructor() { super(); } method() { return new super } }', '"SyntaxError: Cannot use new with super."'); 47 45 shouldNotThrow('x = class extends Base { constructor() { super(); } method1() { delete (super.foo) } method2() { delete super["foo"] } }'); 48 46 shouldThrow('(new x).method1()', '"ReferenceError: Cannot delete a super property"'); -
trunk/Source/JavaScriptCore/ChangeLog
r183754 r183757 1 2015-05-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 new super should be a syntax error 4 https://bugs.webkit.org/show_bug.cgi?id=144282 5 6 Reviewed by Joseph Pecoraro. 7 8 Disallow "new super" as ES6 spec doesn't allow this. 9 10 * parser/Parser.cpp: 11 (JSC::Parser<LexerType>::parseMemberExpression): 12 1 13 2015-05-04 Saam Barati <saambarati1@gmail.com> 2 14 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r183709 r183757 2525 2525 #if ENABLE(ES6_CLASS_SYNTAX) 2526 2526 bool baseIsSuper = match(SUPER); 2527 semanticFailIfTrue(baseIsSuper && newCount, "Cannot use new with super"); 2527 2528 #else 2528 2529 bool baseIsSuper = false; … … 2588 2589 } 2589 2590 endMemberExpression: 2590 semanticFailIfTrue(baseIsSuper && !newCount, "Cannot reference super");2591 semanticFailIfTrue(baseIsSuper, "Cannot reference super"); 2591 2592 while (newCount--) 2592 2593 base = context.createNewExpr(location, base, expressionStart, lastTokenEndPosition());
Note: See TracChangeset
for help on using the changeset viewer.