Changeset 190847 in webkit
- Timestamp:
- Oct 11, 2015 11:46:52 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r190840 r190847 1 2015-10-11 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 ES6 classes: When a class extends B, super() invokes B.prototype.constructor() instead of B() 4 https://bugs.webkit.org/show_bug.cgi?id=149001 5 6 Reviewed by Saam Barati. 7 8 An error message becomes changed. 9 10 * js/class-syntax-call-expected.txt: 11 * js/class-syntax-extends-expected.txt: 12 * js/class-syntax-super-expected.txt: 13 * js/script-tests/class-syntax-call.js: 14 * js/script-tests/class-syntax-extends.js: 15 * js/script-tests/class-syntax-super.js: 16 1 17 2015-10-10 Antti Koivisto <antti@apple.com> 2 18 -
trunk/LayoutTests/js/class-syntax-call-expected.txt
r187680 r190847 10 10 PASS new (class { constructor() {} })() 11 11 PASS (class { constructor() {} })():::"TypeError: Cannot call a class constructor" 12 PASS new (class extends null { constructor() { super() } })():::"TypeError: undefined is not an object(evaluating 'super()')"12 PASS new (class extends null { constructor() { super() } })():::"TypeError: function is not a constructor (evaluating 'super()')" 13 13 PASS (class extends null { constructor() { super() } })():::"TypeError: Cannot call a class constructor" 14 14 PASS successfullyParsed is true -
trunk/LayoutTests/js/class-syntax-extends-expected.txt
r187680 r190847 59 59 PASS class x {}; new (class extends null { constructor () { return new x; } }) instanceof x 60 60 PASS new (class extends null { constructor () { this; } }):::ReferenceError: Cannot access uninitialized variable. 61 PASS new (class extends null { constructor () { super(); } }):::TypeError: undefined is not an object(evaluating 'super()')61 PASS new (class extends null { constructor () { super(); } }):::TypeError: function is not a constructor (evaluating 'super()') 62 62 PASS x = {}; new (class extends null { constructor () { return x } }):::x 63 63 PASS y = 12; new (class extends null { constructor () { return y; } }):::TypeError: Cannot return a non-object type in the constructor of a derived class. -
trunk/LayoutTests/js/class-syntax-super-expected.txt
r187680 r190847 30 30 PASS new (class extends Base { constructor() { return 1; } }):::TypeError: Cannot return a non-object type in the constructor of a derived class. 31 31 PASS new (class extends null { constructor() { return undefined } }):::ReferenceError: Cannot access uninitialized variable. 32 PASS new (class extends null { constructor() { super(); return undefined } }):::TypeError: undefined is not an object(evaluating 'super()')32 PASS new (class extends null { constructor() { super(); return undefined } }):::TypeError: function is not a constructor (evaluating 'super()') 33 33 PASS x = { }; new (class extends null { constructor() { return x } });:::x 34 34 PASS x instanceof Object 35 35 PASS new (class extends null { constructor() { } }):::ReferenceError: Cannot access uninitialized variable. 36 36 PASS new (class extends null { constructor() { return 1; } }):::TypeError: Cannot return a non-object type in the constructor of a derived class. 37 PASS new (class extends null { constructor() { super() } }):::TypeError: undefined is not an object(evaluating 'super()')37 PASS new (class extends null { constructor() { super() } }):::TypeError: function is not a constructor (evaluating 'super()') 38 38 PASS new (class { constructor() { super() } }):::SyntaxError: Cannot call super() in a base class constructor. 39 39 PASS function x() { super(); }:::SyntaxError: Cannot call super() outside of a class constructor. -
trunk/LayoutTests/js/script-tests/class-syntax-call.js
r187680 r190847 38 38 shouldNotThrow('new (class { constructor() {} })()'); 39 39 shouldThrow('(class { constructor() {} })()', '"TypeError: Cannot call a class constructor"'); 40 shouldThrow('new (class extends null { constructor() { super() } })()', '"TypeError: undefined is not an object(evaluating \'super()\')"');40 shouldThrow('new (class extends null { constructor() { super() } })()', '"TypeError: function is not a constructor (evaluating \'super()\')"'); 41 41 shouldThrow('(class extends null { constructor() { super() } })()', '"TypeError: Cannot call a class constructor"'); 42 42 -
trunk/LayoutTests/js/script-tests/class-syntax-extends.js
r187680 r190847 117 117 shouldBeTrue ('class x {}; new (class extends null { constructor () { return new x; } }) instanceof x'); 118 118 shouldThrow('new (class extends null { constructor () { this; } })', '"ReferenceError: Cannot access uninitialized variable."'); 119 shouldThrow('new (class extends null { constructor () { super(); } })', '"TypeError: undefined is not an object(evaluating \'super()\')"');119 shouldThrow('new (class extends null { constructor () { super(); } })', '"TypeError: function is not a constructor (evaluating \'super()\')"'); 120 120 shouldBe('x = {}; new (class extends null { constructor () { return x } })', 'x'); 121 121 shouldThrow('y = 12; new (class extends null { constructor () { return y; } })', '"TypeError: Cannot return a non-object type in the constructor of a derived class."'); -
trunk/LayoutTests/js/script-tests/class-syntax-super.js
r187680 r190847 104 104 shouldThrow('new (class extends Base { constructor() { return 1; } })', '"TypeError: Cannot return a non-object type in the constructor of a derived class."'); 105 105 shouldThrow('new (class extends null { constructor() { return undefined } })'); 106 shouldThrow('new (class extends null { constructor() { super(); return undefined } })', '"TypeError: undefined is not an object(evaluating \'super()\')"');106 shouldThrow('new (class extends null { constructor() { super(); return undefined } })', '"TypeError: function is not a constructor (evaluating \'super()\')"'); 107 107 shouldBe('x = { }; new (class extends null { constructor() { return x } });', 'x'); 108 108 shouldBeTrue('x instanceof Object'); 109 109 shouldThrow('new (class extends null { constructor() { } })', '"ReferenceError: Cannot access uninitialized variable."'); 110 110 shouldThrow('new (class extends null { constructor() { return 1; } })', '"TypeError: Cannot return a non-object type in the constructor of a derived class."'); 111 shouldThrow('new (class extends null { constructor() { super() } })', '"TypeError: undefined is not an object(evaluating \'super()\')"');111 shouldThrow('new (class extends null { constructor() { super() } })', '"TypeError: function is not a constructor (evaluating \'super()\')"'); 112 112 shouldThrow('new (class { constructor() { super() } })', '"SyntaxError: Cannot call super() in a base class constructor."'); 113 113 shouldThrow('function x() { super(); }', '"SyntaxError: Cannot call super() outside of a class constructor."'); -
trunk/Source/JavaScriptCore/ChangeLog
r190843 r190847 1 2015-10-11 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 ES6 classes: When a class extends B, super() invokes B.prototype.constructor() instead of B() 4 https://bugs.webkit.org/show_bug.cgi?id=149001 5 6 Reviewed by Saam Barati. 7 8 This patch matches the `super()` call in the constructor to the latest spec. 9 Before this patch, when calling `super()`, it loads `callee.[[HomeObject]].__proto__.constructor` 10 as a super constructor. But after this patch, it loads `callee.__proto__` as a super constructor. 11 This behavior corresponds to the section 12.3.5.2[1]. 12 13 [1]: http://www.ecma-international.org/ecma-262/6.0/#sec-getsuperconstructor 14 15 * bytecompiler/NodesCodegen.cpp: 16 (JSC::SuperNode::emitBytecode): 17 * tests/stress/super-call-does-not-look-up-constructor.js: Added. 18 (shouldBe): 19 (B): 20 (C): 21 (B.prototype): 22 1 23 2015-10-10 Andreas Kling <akling@apple.com> 2 24 -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r190014 r190847 168 168 callee.setIndex(JSStack::Callee); 169 169 170 RefPtr<RegisterID> homeObject = generator.emitGetById(generator.newTemporary(), &callee, generator.propertyNames().homeObjectPrivateName); 171 RefPtr<RegisterID> protoParent = generator.emitGetById(generator.newTemporary(), homeObject.get(), generator.propertyNames().underscoreProto); 172 return generator.emitGetById(generator.finalDestination(dst), protoParent.get(), generator.propertyNames().constructor); 170 return generator.emitGetById(generator.finalDestination(dst), &callee, generator.propertyNames().underscoreProto); 173 171 } 174 172
Note: See TracChangeset
for help on using the changeset viewer.