| 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 | 6 |
| 7 | 7 |
| 8 (function TestHomeObject() { | 8 (function TestHomeObject() { |
| 9 var object = { | 9 var object = { |
| 10 method() { | 10 method() { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 | 135 |
| 136 (function TestSuperPropertyInEval() { | 136 (function TestSuperPropertyInEval() { |
| 137 var y = 3; | 137 var y = 3; |
| 138 var p = { | 138 var p = { |
| 139 m() { return 1; }, | 139 m() { return 1; }, |
| 140 get x() { return 2; } | 140 get x() { return 2; } |
| 141 }; | 141 }; |
| 142 var o = { | 142 var o = { |
| 143 __proto__: p, | 143 __proto__: p, |
| 144 eval() { | 144 evalM() { |
| 145 assertSame(super.x, eval('super.x')); | 145 assertEquals(1, eval('super.m()')); |
| 146 assertSame(super.m(), eval('super.m()')); | 146 }, |
| 147 // Global eval. | 147 evalX() { |
| 148 assertEquals(2, eval('super.x')); |
| 149 }, |
| 150 globalEval1() { |
| 148 assertThrows('super.x', SyntaxError); | 151 assertThrows('super.x', SyntaxError); |
| 149 assertThrows('super.m()', SyntaxError); | 152 assertThrows('super.m()', SyntaxError); |
| 150 return eval('super.m()'); | 153 }, |
| 154 globalEval2() { |
| 155 super.x; |
| 156 assertThrows('super.x', SyntaxError); |
| 157 assertThrows('super.m()', SyntaxError); |
| 151 } | 158 } |
| 152 }; | 159 }; |
| 153 assertSame(1, o.eval()); | 160 o.evalM(); |
| 161 o.evalX(); |
| 162 o.globalEval1(); |
| 163 o.globalEval2(); |
| 154 })(); | 164 })(); |
| 155 | 165 |
| 156 | 166 |
| 157 (function TestSuperPropertyInArrow() { | 167 (function TestSuperPropertyInArrow() { |
| 158 var y = 3; | 168 var y = 3; |
| 159 var p = { | 169 var p = { |
| 160 m() { return 1; }, | 170 m() { return 1; }, |
| 161 get x() { return 2; } | 171 get x() { return 2; } |
| 162 }; | 172 }; |
| 163 var o = { | 173 var o = { |
| 164 __proto__: p, | 174 __proto__: p, |
| 165 arrow() { | 175 arrow() { |
| 166 assertSame(super.x, (() => super.x)()); | 176 assertSame(super.x, (() => super.x)()); |
| 167 assertSame(super.m(), (() => super.m())()); | 177 assertSame(super.m(), (() => super.m())()); |
| 168 return (() => super.m())(); | 178 return (() => super.m())(); |
| 169 } | 179 } |
| 170 }; | 180 }; |
| 171 assertSame(1, o.arrow()); | 181 assertSame(1, o.arrow()); |
| 172 })(); | 182 })(); |
| OLD | NEW |