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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 (function TestStrictMode() { | 156 (function TestStrictMode() { |
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; | |
caitp
2016/10/27 13:31:02
I don't think we need to remove this line from the
| |
168 } {}; | |
169 assertThrows(function() { | 167 assertThrows(function() { |
170 Object.getPrototypeOf(D).arguments; | 168 Object.getPrototypeOf(D).arguments; |
171 }, TypeError); | 169 }, TypeError); |
172 assertThrows(function() { | |
173 new D; | |
caitp
2016/10/27 13:31:02
I don't think this should have ever thrown in the
Henrique Ferreiro
2016/10/28 09:56:05
The commit message (d5d15253) says: "Classes: Expa
caitp
2016/10/28 13:00:02
sure, but in this file, it occurs in sloppy mode.
| |
174 }, TypeError); | |
175 })(); | 170 })(); |
176 | 171 |
177 | 172 |
178 (function TestToString() { | 173 (function TestToString() { |
179 class C {} | 174 class C {} |
180 assertEquals('class C {}', C.toString()); | 175 assertEquals('class C {}', C.toString()); |
181 | 176 |
182 class D { constructor() { 42; } } | 177 class D { constructor() { 42; } } |
183 assertEquals('class D { constructor() { 42; } }', D.toString()); | 178 assertEquals('class D { constructor() { 42; } }', D.toString()); |
184 | 179 |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1039 function* foo() { | 1034 function* foo() { |
1040 class C extends (yield) {}; | 1035 class C extends (yield) {}; |
1041 } | 1036 } |
1042 var g = foo(); | 1037 var g = foo(); |
1043 g.next(); | 1038 g.next(); |
1044 return g.return(42).value; | 1039 return g.return(42).value; |
1045 } | 1040 } |
1046 assertEquals(42, usingYieldInExtends()); | 1041 assertEquals(42, usingYieldInExtends()); |
1047 | 1042 |
1048 })(); | 1043 })(); |
OLD | NEW |