| 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 --harmony-arrow-functions --allow-natives-syntax | 5 // Flags: --harmony-classes --harmony-arrow-functions --allow-natives-syntax |
| 6 // Flags: --harmony-spreadcalls | 6 // Flags: --harmony-spreadcalls |
| 7 | 7 |
| 8 (function TestSuperNamedLoads() { | 8 (function TestSuperNamedLoads() { |
| 9 function Base() { } | 9 function Base() { } |
| 10 function fBase() { } | 10 function fBase() { } |
| (...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 | 2069 |
| 2070 | 2070 |
| 2071 (function TestSuperPropertyInEval() { | 2071 (function TestSuperPropertyInEval() { |
| 2072 'use strict'; | 2072 'use strict'; |
| 2073 let y = 3; | 2073 let y = 3; |
| 2074 class Base { | 2074 class Base { |
| 2075 m() { return 1; } | 2075 m() { return 1; } |
| 2076 get x() { return 2; } | 2076 get x() { return 2; } |
| 2077 } | 2077 } |
| 2078 class Derived extends Base { | 2078 class Derived extends Base { |
| 2079 eval() { | 2079 evalM() { |
| 2080 assertSame(super.x, eval('super.x')); | 2080 assertEquals(1, eval('super.m()')); |
| 2081 assertSame(super.m(), eval('super.m()')); | 2081 } |
| 2082 // Global eval. | 2082 evalX() { |
| 2083 assertEquals(2, eval('super.x')); |
| 2084 } |
| 2085 globalEval1() { |
| 2083 assertThrows('super.x', SyntaxError); | 2086 assertThrows('super.x', SyntaxError); |
| 2084 assertThrows('super.m()', SyntaxError); | 2087 assertThrows('super.m()', SyntaxError); |
| 2085 return eval('super.m()'); | 2088 } |
| 2089 globalEval2() { |
| 2090 super.x; |
| 2091 assertThrows('super.x', SyntaxError); |
| 2092 assertThrows('super.m()', SyntaxError); |
| 2086 } | 2093 } |
| 2087 } | 2094 } |
| 2088 let d = new Derived(); | 2095 let d = new Derived(); |
| 2089 assertSame(1, d.eval()); | 2096 d.globalEval1(); |
| 2097 d.globalEval2(); |
| 2098 d.evalM(); |
| 2099 d.evalX(); |
| 2090 })(); | 2100 })(); |
| 2091 | 2101 |
| 2092 | 2102 |
| 2093 (function TestSuperPropertyInArrow() { | 2103 (function TestSuperPropertyInArrow() { |
| 2094 'use strict'; | 2104 'use strict'; |
| 2095 let y = 3; | 2105 let y = 3; |
| 2096 class Base { | 2106 class Base { |
| 2097 m() { return 1; } | 2107 m() { return 1; } |
| 2098 get x() { return 2; } | 2108 get x() { return 2; } |
| 2099 } | 2109 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 } | 2206 } |
| 2197 } | 2207 } |
| 2198 class Derived extends Base { | 2208 class Derived extends Base { |
| 2199 constructor(x) { | 2209 constructor(x) { |
| 2200 (() => super(...[x]))(); | 2210 (() => super(...[x]))(); |
| 2201 } | 2211 } |
| 2202 } | 2212 } |
| 2203 let d = new Derived(42); | 2213 let d = new Derived(42); |
| 2204 assertSame(42, d.x); | 2214 assertSame(42, d.x); |
| 2205 })(); | 2215 })(); |
| OLD | NEW |