| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --harmony-classes --allow-natives-syntax | 5 // Flags: --harmony-classes --allow-natives-syntax |
| 6 | 6 |
| 7 (function TestSuperNamedLoads() { | 7 (function TestSuperNamedLoads() { |
| 8 function Base() { } | 8 function Base() { } |
| 9 function fBase() { } | 9 function fBase() { } |
| 10 Base.prototype = { | 10 Base.prototype = { |
| (...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 | 2046 |
| 2047 (function TestExtendsObject() { | 2047 (function TestExtendsObject() { |
| 2048 'use strict'; | 2048 'use strict'; |
| 2049 class F extends Object { } | 2049 class F extends Object { } |
| 2050 var f = new F(42); | 2050 var f = new F(42); |
| 2051 | 2051 |
| 2052 // TODO(dslomov,arv): Fix this. BUG=v8:3886. | 2052 // TODO(dslomov,arv): Fix this. BUG=v8:3886. |
| 2053 assertInstanceof(f, Number); | 2053 assertInstanceof(f, Number); |
| 2054 }()); | 2054 }()); |
| 2055 | 2055 |
| 2056 |
| 2056 (function TestSuperCallErrorCases() { | 2057 (function TestSuperCallErrorCases() { |
| 2057 'use strict'; | 2058 'use strict'; |
| 2058 class T extends Object { | 2059 class T extends Object { |
| 2059 constructor() { | 2060 constructor() { |
| 2060 super(); | 2061 super(); |
| 2061 } | 2062 } |
| 2062 } | 2063 } |
| 2063 | 2064 |
| 2064 T.__proto__ = null; | 2065 T.__proto__ = null; |
| 2065 assertThrows(function() { new T(); }, TypeError); | 2066 assertThrows(function() { new T(); }, TypeError); |
| 2066 }()); | 2067 }()); |
| 2068 |
| 2069 |
| 2070 // TODO(arv): This depends on lexical this which is in progress. Enable and add |
| 2071 // similar test to object-literal-super.js |
| 2072 // (function TestSuperPropertyInEval() { |
| 2073 // 'use strict'; |
| 2074 // let y = 3; |
| 2075 // class Base { |
| 2076 // m() { return 1; } |
| 2077 // get x() { return 2; } |
| 2078 // set y(v) { y = v; } |
| 2079 // } |
| 2080 // class Derived extends Base { |
| 2081 // n() { |
| 2082 // assertSame(super.x, eval('super.x')); |
| 2083 // assertSame(super.m(), eval('super.m()')); |
| 2084 // return eval('super.m()'); |
| 2085 // } |
| 2086 // } |
| 2087 // let d = new Derived(); |
| 2088 // assertSame(1, d.n()); |
| 2089 // })(); |
| OLD | NEW |