| 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: --allow-natives-syntax --harmony-do-expressions | 5 // Flags: --allow-natives-syntax --harmony-do-expressions |
| 6 | 6 |
| 7 (function TestBasics() { | 7 (function TestBasics() { |
| 8 var C = class C {} | 8 var C = class C {} |
| 9 assertEquals(typeof C, 'function'); | 9 assertEquals(typeof C, 'function'); |
| 10 assertEquals(C.__proto__, Function.prototype); | 10 assertEquals(C.__proto__, Function.prototype); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 class C {} | 157 class C {} |
| 158 | 158 |
| 159 with ({a: 1}) { | 159 with ({a: 1}) { |
| 160 assertEquals(1, a); | 160 assertEquals(1, a); |
| 161 } | 161 } |
| 162 | 162 |
| 163 assertThrows('class C extends function B() { with ({}); return B; }() {}', | 163 assertThrows('class C extends function B() { with ({}); return B; }() {}', |
| 164 SyntaxError); | 164 SyntaxError); |
| 165 | 165 |
| 166 var D = class extends function() { | 166 var D = class extends function() { |
| 167 arguments.caller; | 167 this.args = arguments; |
| 168 } {}; | 168 } {}; |
| 169 assertThrows(function() { | 169 assertThrows(function() { |
| 170 Object.getPrototypeOf(D).arguments; | 170 Object.getPrototypeOf(D).arguments; |
| 171 }, TypeError); | 171 }, TypeError); |
| 172 assertThrows(function() { | 172 var e = new D(); |
| 173 new D; | 173 assertThrows(() => e.args.callee, TypeError); |
| 174 }, TypeError); | 174 assertEquals(undefined, Object.getOwnPropertyDescriptor(e.args, 'caller')); |
| 175 assertFalse('caller' in e.args); |
| 175 })(); | 176 })(); |
| 176 | 177 |
| 177 | 178 |
| 178 (function TestToString() { | 179 (function TestToString() { |
| 179 class C {} | 180 class C {} |
| 180 assertEquals('class C {}', C.toString()); | 181 assertEquals('class C {}', C.toString()); |
| 181 | 182 |
| 182 class D { constructor() { 42; } } | 183 class D { constructor() { 42; } } |
| 183 assertEquals('class D { constructor() { 42; } }', D.toString()); | 184 assertEquals('class D { constructor() { 42; } }', D.toString()); |
| 184 | 185 |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 function* foo() { | 1040 function* foo() { |
| 1040 class C extends (yield) {}; | 1041 class C extends (yield) {}; |
| 1041 } | 1042 } |
| 1042 var g = foo(); | 1043 var g = foo(); |
| 1043 g.next(); | 1044 g.next(); |
| 1044 return g.return(42).value; | 1045 return g.return(42).value; |
| 1045 } | 1046 } |
| 1046 assertEquals(42, usingYieldInExtends()); | 1047 assertEquals(42, usingYieldInExtends()); |
| 1047 | 1048 |
| 1048 })(); | 1049 })(); |
| OLD | NEW |