Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1063)

Side by Side Diff: test/mjsunit/es8/syntactic-tail-call-parsing.js

Issue 2317873002: Revert of Merged: Disallow tail calls from async functions and generators (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 --harmony-async-await 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",
11 tests: [ 11 tests: [
12 { src: `()=>{ return continue foo ; }`, 12 { src: `()=>{ return continue foo ; }`,
13 err: ` ^^^`, 13 err: ` ^^^`,
14 }, 14 },
15 { src: `()=>{ return continue 42 ; }`, 15 { src: `()=>{ return continue 42 ; }`,
16 err: ` ^^`, 16 err: ` ^^`,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 { src: `()=>{ return bar instanceof continue foo() ; }`, 121 { src: `()=>{ return bar instanceof continue foo() ; }`,
122 err: ` ^^^^^^^^^^^^^^`, 122 err: ` ^^^^^^^^^^^^^^`,
123 }, 123 },
124 { src: `()=>{ return continue foo() in bar ; }`, 124 { src: `()=>{ return continue foo() in bar ; }`,
125 err: ` ^^^^^^^^^^^^^^`, 125 err: ` ^^^^^^^^^^^^^^`,
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 },
133 { src: `()=>{ function* G() { return continue foo(); } }`,
134 err: ` ^^^^^`,
135 }, 132 },
136 { src: `()=>{ (1, 2, 3, continue f() ) => {} }`, 133 { src: `()=>{ (1, 2, 3, continue f() ) => {} }`,
137 err: ` ^^^^^^^^^^^^`, 134 err: ` ^^^^^^^^^^^^`,
138 }, 135 },
139 { src: `()=>{ (... continue f()) => {} }`, 136 { src: `()=>{ (... continue f()) => {} }`,
140 err: ` ^^^^^^^^^^^^`, 137 err: ` ^^^^^^^^^^^^`,
141 }, 138 },
142 { src: `()=>{ (a, b, c, ... continue f() ) => {} }`, 139 { src: `()=>{ (a, b, c, ... continue f() ) => {} }`,
143 err: ` ^^^^^^^^^^^^`, 140 err: ` ^^^^^^^^^^^^`,
144 }, 141 },
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 }, 228 },
232 { src: `()=>{ const c = continue foo() }`, 229 { src: `()=>{ const c = continue foo() }`,
233 err: ` ^^^^^^^^^^^^^^^`, 230 err: ` ^^^^^^^^^^^^^^^`,
234 }, 231 },
235 { src: `class A {}; class B extends A { constructor() { return continue fo o () ; } }`, 232 { src: `class A {}; class B extends A { constructor() { return continue fo o () ; } }`,
236 err: ` ^^^^^^^^^^^ ^^^^`, 233 err: ` ^^^^^^^^^^^ ^^^^`,
237 }, 234 },
238 { src: `class A extends continue f () {}; }`, 235 { src: `class A extends continue f () {}; }`,
239 err: ` ^^^^^^^^^^^^^`, 236 err: ` ^^^^^^^^^^^^^`,
240 }, 237 },
241 { src: `async() => continue foo()`,
242 err: ` ^^^^^`,
243 },
244 ], 238 ],
245 }, 239 },
246 { msg: "Tail call expression in try block", 240 { msg: "Tail call expression in try block",
247 tests: [ 241 tests: [
248 { src: `()=>{ try { return continue f ( ) ; } catch(e) {} }`, 242 { src: `()=>{ try { return continue f ( ) ; } catch(e) {} }`,
249 err: ` ^^^^^^^^^^^^^^^^`, 243 err: ` ^^^^^^^^^^^^^^^^`,
250 }, 244 },
251 { src: `()=>{ try { try { smth; } catch(e) { return continue f( ) ; } }` , 245 { src: `()=>{ try { try { smth; } catch(e) { return continue f( ) ; } }` ,
252 err: ` ^^^^^^^^^^^^^^`, 246 err: ` ^^^^^^^^^^^^^^`,
253 }, 247 },
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 `()=>{ return continue a.b.c.foo () ; }`, 304 `()=>{ return continue a.b.c.foo () ; }`,
311 `()=>{ return continue a().b.c().d.foo () ; }`, 305 `()=>{ return continue a().b.c().d.foo () ; }`,
312 `()=>{ return continue foo (1)(2)(3, 4) ; }`, 306 `()=>{ return continue foo (1)(2)(3, 4) ; }`,
313 `()=>{ return continue (0, eval)(); }`, 307 `()=>{ return continue (0, eval)(); }`,
314 `()=>{ return ( continue b() ) ; }`, 308 `()=>{ return ( continue b() ) ; }`,
315 "()=>{ return continue bar`ab cd ef` ; }", 309 "()=>{ return continue bar`ab cd ef` ; }",
316 "()=>{ return continue bar`ab ${cd} ef` ; }", 310 "()=>{ return continue bar`ab ${cd} ef` ; }",
317 `()=>{ return a || continue f() ; }`, 311 `()=>{ return a || continue f() ; }`,
318 `()=>{ return a && continue f() ; }`, 312 `()=>{ return a && continue f() ; }`,
319 `()=>{ return a , continue f() ; }`, 313 `()=>{ return a , continue f() ; }`,
314 `()=>{ function* G() { return continue foo(); } }`,
320 `()=>{ class A { foo() { return continue super.f() ; } } }`, 315 `()=>{ class A { foo() { return continue super.f() ; } } }`,
321 `()=>{ function B() { return continue new.target() ; } }`, 316 `()=>{ function B() { return continue new.target() ; } }`,
322 `()=>{ return continue do { x ? foo() : bar() ; }() }`, 317 `()=>{ return continue do { x ? foo() : bar() ; }() }`,
323 `()=>{ return continue (do { x ? foo() : bar() ; })() }`, 318 `()=>{ return continue (do { x ? foo() : bar() ; })() }`,
324 `()=>{ return do { 1, continue foo() } }`, 319 `()=>{ return do { 1, continue foo() } }`,
325 `()=>{ return do { x ? continue foo() : y } }`, 320 `()=>{ return do { x ? continue foo() : y } }`,
326 `()=>{ return a || (b && continue c()); }`, 321 `()=>{ return a || (b && continue c()); }`,
327 `()=>{ return a && (b || continue c()); }`, 322 `()=>{ return a && (b || continue c()); }`,
328 `()=>{ return a || (b ? c : continue d()); }`, 323 `()=>{ return a || (b ? c : continue d()); }`,
329 `()=>{ return 1, 2, 3, a || (b ? c : continue d()); }`, 324 `()=>{ return 1, 2, 3, a || (b ? c : continue d()); }`,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 (function() { 379 (function() {
385 for (var src of NoErrorTests) { 380 for (var src of NoErrorTests) {
386 print("======================================="); 381 print("=======================================");
387 print("Source | " + src); 382 print("Source | " + src);
388 src = `"use strict"; ` + src; 383 src = `"use strict"; ` + src;
389 Realm.eval(0, src); 384 Realm.eval(0, src);
390 print("PASSED"); 385 print("PASSED");
391 print(); 386 print();
392 } 387 }
393 })(); 388 })();
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698