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 "use strict"; | 7 "use strict"; |
8 | 8 |
9 var SyntaxErrorTests = [ | 9 var SyntaxErrorTests = [ |
10 { msg: "Unexpected expression inside tail call", | 10 { msg: "Unexpected expression inside tail call", |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 }, | 126 }, |
127 { src: `()=>{ return bar in continue foo() ; }`, | 127 { src: `()=>{ return bar in continue foo() ; }`, |
128 err: ` ^^^^^^^^^^^^^^`, | 128 err: ` ^^^^^^^^^^^^^^`, |
129 }, | 129 }, |
130 { src: `()=>{ function* G() { yield continue foo(); } }`, | 130 { src: `()=>{ function* G() { yield continue foo(); } }`, |
131 err: ` ^^^^^^^^^^^^^^`, | 131 err: ` ^^^^^^^^^^^^^^`, |
132 }, | 132 }, |
133 { src: `()=>{ (1, 2, 3, continue f() ) => {} }`, | 133 { src: `()=>{ (1, 2, 3, continue f() ) => {} }`, |
134 err: ` ^^^^^^^^^^^^`, | 134 err: ` ^^^^^^^^^^^^`, |
135 }, | 135 }, |
136 { src: `()=>{ (... continue f()) => {} }`, | |
137 err: ` ^^^^^^^^^^^^`, | |
138 }, | |
139 { src: `()=>{ (a, b, c, ... continue f() ) => {} }`, | |
140 err: ` ^^^^^^^^^^^^`, | |
141 }, | |
142 { src: `()=>{ return a <= continue f(); }`, | 136 { src: `()=>{ return a <= continue f(); }`, |
143 err: ` ^^^^^^^^^^^^`, | 137 err: ` ^^^^^^^^^^^^`, |
144 }, | 138 }, |
145 { src: `()=>{ return b > continue f(); }`, | 139 { src: `()=>{ return b > continue f(); }`, |
146 err: ` ^^^^^^^^^^^^`, | 140 err: ` ^^^^^^^^^^^^`, |
147 }, | 141 }, |
148 { src: `()=>{ return a << continue f(); }`, | 142 { src: `()=>{ return a << continue f(); }`, |
149 err: ` ^^^^^^^^^^^^`, | 143 err: ` ^^^^^^^^^^^^`, |
150 }, | 144 }, |
151 { src: `()=>{ return b >> continue f(); }`, | 145 { src: `()=>{ return b >> continue f(); }`, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 err: ` ^^^^^^^^^`, | 276 err: ` ^^^^^^^^^`, |
283 }, | 277 }, |
284 { src: `()=> a, continue eval ( ) ; `, | 278 { src: `()=> a, continue eval ( ) ; `, |
285 err: ` ^^^^^^^^^`, | 279 err: ` ^^^^^^^^^`, |
286 }, | 280 }, |
287 { src: `()=> a || continue eval (' ' ) ; `, | 281 { src: `()=> a || continue eval (' ' ) ; `, |
288 err: ` ^^^^^^^^^^^^`, | 282 err: ` ^^^^^^^^^^^^`, |
289 }, | 283 }, |
290 ], | 284 ], |
291 }, | 285 }, |
286 { msg: "Unexpected token continue", | |
287 tests: [ | |
288 { src: `()=>{ (... continue f()) => {} }`, | |
289 err: ` ^^^^^^^^`, | |
290 }, | |
291 { src: `()=>{ (a, b, c, ... continue f() ) => {} }`, | |
Dan Ehrenberg
2016/08/26 22:48:53
This is also a worse message. It's only acceptable
nickie
2016/08/29 08:42:59
I can live with it; I think it is a bad error mess
| |
292 err: ` ^^^^^^^^`, | |
293 }, | |
294 ], | |
295 }, | |
292 { msg: "Undefined label 'foo'", | 296 { msg: "Undefined label 'foo'", |
293 tests: [ | 297 tests: [ |
294 { src: `()=>{ continue foo () ; }`, | 298 { src: `()=>{ continue foo () ; }`, |
295 err: ` ^^^`, | 299 err: ` ^^^`, |
296 }, | 300 }, |
297 ], | 301 ], |
298 }, | 302 }, |
299 ]; | 303 ]; |
300 | 304 |
301 | 305 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 (function() { | 383 (function() { |
380 for (var src of NoErrorTests) { | 384 for (var src of NoErrorTests) { |
381 print("======================================="); | 385 print("======================================="); |
382 print("Source | " + src); | 386 print("Source | " + src); |
383 src = `"use strict"; ` + src; | 387 src = `"use strict"; ` + src; |
384 Realm.eval(0, src); | 388 Realm.eval(0, src); |
385 print("PASSED"); | 389 print("PASSED"); |
386 print(); | 390 print(); |
387 } | 391 } |
388 })(); | 392 })(); |
OLD | NEW |