OLD | NEW |
---|---|
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 7780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7791 const char* body_data[] = { | 7791 const char* body_data[] = { |
7792 "var async = 1; return async;", | 7792 "var async = 1; return async;", |
7793 "let async = 1; return async;", | 7793 "let async = 1; return async;", |
7794 "const async = 1; return async;", | 7794 "const async = 1; return async;", |
7795 "function async() {} return async();", | 7795 "function async() {} return async();", |
7796 "var async = async => async; return async();", | 7796 "var async = async => async; return async();", |
7797 "function foo() { var await = 1; return await; }", | 7797 "function foo() { var await = 1; return await; }", |
7798 "function foo(await) { return await; }", | 7798 "function foo(await) { return await; }", |
7799 "function* foo() { var await = 1; return await; }", | 7799 "function* foo() { var await = 1; return await; }", |
7800 "function* foo(await) { return await; }", | 7800 "function* foo(await) { return await; }", |
7801 "var f = (await) => await;", | |
7802 "var f = () => { var await = 1; return await; }", | 7801 "var f = () => { var await = 1; return await; }", |
7803 "var O = { method() { var await = 1; return await; } };", | 7802 "var O = { method() { var await = 1; return await; } };", |
7804 "var O = { method(await) { return await; } };", | 7803 "var O = { method(await) { return await; } };", |
7805 "var O = { *method() { var await = 1; return await; } };", | 7804 "var O = { *method() { var await = 1; return await; } };", |
7806 "var O = { *method(await) { return await; } };", | 7805 "var O = { *method(await) { return await; } };", |
7807 | 7806 |
7808 "(function await() {})", | 7807 "(function await() {})", |
7809 NULL | 7808 NULL |
7810 }; | 7809 }; |
7811 // clang-format on | 7810 // clang-format on |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7878 "class C { static async prototype() {} }", | 7877 "class C { static async prototype() {} }", |
7879 "class C {}; class C2 extends C { static async prototype() {} }", | 7878 "class C {}; class C2 extends C { static async prototype() {} }", |
7880 | 7879 |
7881 "var f = async() => ((async(x = await 1) => x)();", | 7880 "var f = async() => ((async(x = await 1) => x)();", |
7882 | 7881 |
7883 "var asyncFn = async function() { function await() {} }", | 7882 "var asyncFn = async function() { function await() {} }", |
7884 "var asyncFn = async() => { function await() {} }", | 7883 "var asyncFn = async() => { function await() {} }", |
7885 "var O = { async method() { function await() {} } }", | 7884 "var O = { async method() { function await() {} } }", |
7886 "async function foo() { function await() {} }", | 7885 "async function foo() { function await() {} }", |
7887 | 7886 |
7887 "async function foo() { var f = await => 42; }", | |
7888 "async function foo() { var f = (await) => 42; }", | |
7889 "async function foo() { var f = (await, a) => 42; }", | |
7890 "async function foo() { var f = (...await) => 42; }", | |
7891 | |
7892 "async function f() { return (await) }", | |
7893 "async function f() { return (await, f) }", | |
7894 "async function f() { return [await] }", | |
7895 "async function f() { return (await = 42) }", | |
Dan Ehrenberg
2016/08/22 01:48:53
Consider adding tests for other kinds of async fun
adamk
2016/08/22 17:59:59
I've refactored this test to have a section for st
| |
7896 | |
7888 // Henrique Ferreiro's bug (tm) | 7897 // Henrique Ferreiro's bug (tm) |
7889 "(async function foo1() { } foo2 => 1)", | 7898 "(async function foo1() { } foo2 => 1)", |
7890 "(async function foo3() { } () => 1)", | 7899 "(async function foo3() { } () => 1)", |
7891 "(async function foo4() { } => 1)", | 7900 "(async function foo4() { } => 1)", |
7892 "(async function() { } foo5 => 1)", | 7901 "(async function() { } foo5 => 1)", |
7893 "(async function() { } () => 1)", | 7902 "(async function() { } () => 1)", |
7894 "(async function() { } => 1)", | 7903 "(async function() { } => 1)", |
7895 "(async.foo6 => 1)", | 7904 "(async.foo6 => 1)", |
7896 "(async.foo7 foo8 => 1)", | 7905 "(async.foo7 foo8 => 1)", |
7897 "(async.foo9 () => 1)", | 7906 "(async.foo9 () => 1)", |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8187 "(a,);", | 8196 "(a,);", |
8188 "(a,b,c,);", | 8197 "(a,b,c,);", |
8189 NULL | 8198 NULL |
8190 }; | 8199 }; |
8191 // clang-format on | 8200 // clang-format on |
8192 | 8201 |
8193 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 8202 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; |
8194 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 8203 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
8195 arraysize(always_flags)); | 8204 arraysize(always_flags)); |
8196 } | 8205 } |
OLD | NEW |