OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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-explicit-tailcalls | 5 // Flags: --allow-natives-syntax --harmony-explicit-tailcalls |
6 // Flags: --harmony-do-expressions | 6 // Flags: --harmony-do-expressions |
7 | 7 |
8 var SyntaxErrorTests = [ | 8 var SyntaxErrorTests = [ |
9 { msg: "Unexpected expression inside tail call", | 9 { msg: "Unexpected expression inside tail call", |
10 tests: [ | 10 tests: [ |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 }, | 135 }, |
136 { src: `()=>{ return bar in continue foo() ; }`, | 136 { src: `()=>{ return bar in continue foo() ; }`, |
137 err: ` ^^^^^^^^^^^^^^`, | 137 err: ` ^^^^^^^^^^^^^^`, |
138 }, | 138 }, |
139 { src: `()=>{ function* G() { yield continue foo(); } }`, | 139 { src: `()=>{ function* G() { yield continue foo(); } }`, |
140 err: ` ^^^^^^^^^^^^^^`, | 140 err: ` ^^^^^^^^^^^^^^`, |
141 }, | 141 }, |
142 { src: `()=>{ (1, 2, 3, continue f() ) => {} }`, | 142 { src: `()=>{ (1, 2, 3, continue f() ) => {} }`, |
143 err: ` ^^^^^^^^^^^^`, | 143 err: ` ^^^^^^^^^^^^`, |
144 }, | 144 }, |
145 { src: `()=>{ (... continue f()) => {} }`, | |
146 err: ` ^^^^^^^^^^^^`, | |
147 }, | |
148 { src: `()=>{ (a, b, c, ... continue f() ) => {} }`, | |
149 err: ` ^^^^^^^^^^^^`, | |
150 }, | |
151 { src: `()=>{ return a <= continue f(); }`, | 145 { src: `()=>{ return a <= continue f(); }`, |
152 err: ` ^^^^^^^^^^^^`, | 146 err: ` ^^^^^^^^^^^^`, |
153 }, | 147 }, |
154 { src: `()=>{ return b > continue f(); }`, | 148 { src: `()=>{ return b > continue f(); }`, |
155 err: ` ^^^^^^^^^^^^`, | 149 err: ` ^^^^^^^^^^^^`, |
156 }, | 150 }, |
157 { src: `()=>{ return a << continue f(); }`, | 151 { src: `()=>{ return a << continue f(); }`, |
158 err: ` ^^^^^^^^^^^^`, | 152 err: ` ^^^^^^^^^^^^`, |
159 }, | 153 }, |
160 { src: `()=>{ return b >> continue f(); }`, | 154 { src: `()=>{ return b >> continue f(); }`, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 err: ` ^^^^^^^^^^^^^^^^`, | 320 err: ` ^^^^^^^^^^^^^^^^`, |
327 }, | 321 }, |
328 { src: `()=> a && continue foo () ;`, | 322 { src: `()=> a && continue foo () ;`, |
329 err: ` ^^^^^^^^^^^^^^^^`, | 323 err: ` ^^^^^^^^^^^^^^^^`, |
330 }, | 324 }, |
331 { src: `()=> a ? continue foo () : b;`, | 325 { src: `()=> a ? continue foo () : b;`, |
332 err: ` ^^^^^^^^^^^^^^^^`, | 326 err: ` ^^^^^^^^^^^^^^^^`, |
333 }, | 327 }, |
334 ], | 328 ], |
335 }, | 329 }, |
| 330 { msg: "Unexpected token continue", |
| 331 tests: [ |
| 332 { src: `()=>{ (... continue f()) => {} }`, |
| 333 err: ` ^^^^^^^^`, |
| 334 }, |
| 335 { src: `()=>{ (a, b, c, ... continue f() ) => {} }`, |
| 336 err: ` ^^^^^^^^`, |
| 337 }, |
| 338 ], |
| 339 }, |
336 { msg: "Undefined label 'foo'", | 340 { msg: "Undefined label 'foo'", |
337 tests: [ | 341 tests: [ |
338 { src: `()=>{ continue foo () ; }`, | 342 { src: `()=>{ continue foo () ; }`, |
339 err: ` ^^^`, | 343 err: ` ^^^`, |
340 }, | 344 }, |
341 ], | 345 ], |
342 }, | 346 }, |
343 ]; | 347 ]; |
344 | 348 |
345 | 349 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 405 |
402 (function() { | 406 (function() { |
403 for (var src of NoErrorTests) { | 407 for (var src of NoErrorTests) { |
404 print("======================================="); | 408 print("======================================="); |
405 print("Source | " + src); | 409 print("Source | " + src); |
406 Realm.eval(0, src); | 410 Realm.eval(0, src); |
407 print("PASSED"); | 411 print("PASSED"); |
408 print(); | 412 print(); |
409 } | 413 } |
410 })(); | 414 })(); |
OLD | NEW |