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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2089733002: [parser] only parse async arrow function when necessary (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 7622 matching lines...) Expand 10 before | Expand all | Expand 10 after
7633 "class C { static async prototype() {} }", 7633 "class C { static async prototype() {} }",
7634 "class C {}; class C2 extends C { static async prototype() {} }", 7634 "class C {}; class C2 extends C { static async prototype() {} }",
7635 7635
7636 "var f = async() => ((async(x = await 1) => x)();", 7636 "var f = async() => ((async(x = await 1) => x)();",
7637 7637
7638 "var asyncFn = async function() { function await() {} }", 7638 "var asyncFn = async function() { function await() {} }",
7639 "var asyncFn = async() => { function await() {} }", 7639 "var asyncFn = async() => { function await() {} }",
7640 "var O = { async method() { function await() {} } }", 7640 "var O = { async method() { function await() {} } }",
7641 "async function foo() { function await() {} }", 7641 "async function foo() { function await() {} }",
7642 7642
7643 // Henrique Ferreiro's bug (tm)
7644 "(async function foo() { } foo => 1)",
7645 "(async function foo() { } () => 1)",
7646 "(async function foo() { } => 1)",
7647 "(async function() { } foo => 1)",
7648 "(async function() { } () => 1)",
7649 "(async function() { } => 1)",
7650 "(async.foo => 1)",
7651 "(async.foo foo => 1)",
7652 "(async.foo () => 1)",
7653 "(async().foo => 1)",
7654 "(async().foo foo => 1)",
7655 "(async().foo () => 1)",
7656 "(async['foo'] => 1)",
7657 "(async['foo'] foo => 1)",
7658 "(async['foo'] () => 1)",
7659 "(async()['foo'] => 1)",
7660 "(async()['foo'] foo => 1)",
7661 "(async()['foo'] () => 1)",
7662 "(async`foo` => 1)",
7663 "(async`foo` foo => 1)",
7664 "(async`foo` () => 1)",
7665 "(async`foo`.bar => 1)",
7666 "(async`foo`.bar foo => 1)",
7667 "(async`foo`.bar () => 1)",
7643 NULL 7668 NULL
7644 }; 7669 };
7645 7670
7646 const char* strict_error_data[] = { 7671 const char* strict_error_data[] = {
7647 "var O = { async method(eval) {} }", 7672 "var O = { async method(eval) {} }",
7648 "var O = { async ['meth' + 'od'](eval) {} }", 7673 "var O = { async ['meth' + 'od'](eval) {} }",
7649 "var O = { async 'method'(eval) {} }", 7674 "var O = { async 'method'(eval) {} }",
7650 "var O = { async 0(eval) {} }", 7675 "var O = { async 0(eval) {} }",
7651 7676
7652 "var O = { async method(arguments) {} }", 7677 "var O = { async method(arguments) {} }",
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
7782 NULL}; 7807 NULL};
7783 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; 7808 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait};
7784 // The preparser doesn't enforce the restriction, so turn it off. 7809 // The preparser doesn't enforce the restriction, so turn it off.
7785 bool test_preparser = false; 7810 bool test_preparser = false;
7786 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0, 7811 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0,
7787 always_flags, arraysize(always_flags), NULL, 0, false, 7812 always_flags, arraysize(always_flags), NULL, 0, false,
7788 test_preparser); 7813 test_preparser);
7789 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0, 7814 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0,
7790 always_flags, arraysize(always_flags)); 7815 always_flags, arraysize(always_flags));
7791 } 7816 }
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