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 7667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7678 "var asyncFn = async x => await x + 'test';", | 7678 "var asyncFn = async x => await x + 'test';", |
7679 "async function asyncFn() { await 1; }", | 7679 "async function asyncFn() { await 1; }", |
7680 "var O = { async method() { await 1; } }", | 7680 "var O = { async method() { await 1; } }", |
7681 "var O = { async ['meth' + 'od']() { await 1; } }", | 7681 "var O = { async ['meth' + 'od']() { await 1; } }", |
7682 "var O = { async 'method'() { await 1; } }", | 7682 "var O = { async 'method'() { await 1; } }", |
7683 "var O = { async 0() { await 1; } }", | 7683 "var O = { async 0() { await 1; } }", |
7684 "async function await() {}", | 7684 "async function await() {}", |
7685 | 7685 |
7686 "var asyncFn = async({ foo = 1 }) => foo;", | 7686 "var asyncFn = async({ foo = 1 }) => foo;", |
7687 "var asyncFn = async({ foo = 1 } = {}) => foo;", | 7687 "var asyncFn = async({ foo = 1 } = {}) => foo;", |
| 7688 |
| 7689 "function* g() { var f = async(yield); }", |
| 7690 "function* g() { var f = async(x = yield); }", |
7688 NULL | 7691 NULL |
7689 }; | 7692 }; |
7690 // clang-format on | 7693 // clang-format on |
7691 | 7694 |
7692 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; | 7695 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; |
7693 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | 7696 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
7694 arraysize(always_flags)); | 7697 arraysize(always_flags)); |
7695 | 7698 |
7696 // clang-format off | 7699 // clang-format off |
7697 const char* async_body_context_data[][2] = { | 7700 const char* async_body_context_data[][2] = { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7785 "var O = { async *method() {} };", | 7788 "var O = { async *method() {} };", |
7786 "var O = { async method*() {} };", | 7789 "var O = { async method*() {} };", |
7787 | 7790 |
7788 "var asyncFn = async function(x = await 1) { return x; }", | 7791 "var asyncFn = async function(x = await 1) { return x; }", |
7789 "async function f(x = await 1) { return x; }", | 7792 "async function f(x = await 1) { return x; }", |
7790 "var f = async(x = await 1) => x;", | 7793 "var f = async(x = await 1) => x;", |
7791 "var O = { async method(x = await 1) { return x; } };", | 7794 "var O = { async method(x = await 1) { return x; } };", |
7792 | 7795 |
7793 "var f = async(x = await) => 1;", | 7796 "var f = async(x = await) => 1;", |
7794 | 7797 |
| 7798 "function* g() { var f = async yield => 1; }", |
| 7799 "function* g() { var f = async(yield) => 1; }", |
| 7800 "function* g() { var f = async(x = yield) => 1; }", |
| 7801 "function* g() { var f = async({x = yield}) => 1; }", |
| 7802 |
7795 "class C { async constructor() {} }", | 7803 "class C { async constructor() {} }", |
7796 "class C {}; class C2 extends C { async constructor() {} }", | 7804 "class C {}; class C2 extends C { async constructor() {} }", |
7797 "class C { static async prototype() {} }", | 7805 "class C { static async prototype() {} }", |
7798 "class C {}; class C2 extends C { static async prototype() {} }", | 7806 "class C {}; class C2 extends C { static async prototype() {} }", |
7799 | 7807 |
7800 "var f = async() => ((async(x = await 1) => x)();", | 7808 "var f = async() => ((async(x = await 1) => x)();", |
7801 | 7809 |
7802 // Henrique Ferreiro's bug (tm) | 7810 // Henrique Ferreiro's bug (tm) |
7803 "(async function foo1() { } foo2 => 1)", | 7811 "(async function foo1() { } foo2 => 1)", |
7804 "(async function foo3() { } () => 1)", | 7812 "(async function foo3() { } () => 1)", |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8143 "(a,);", | 8151 "(a,);", |
8144 "(a,b,c,);", | 8152 "(a,b,c,);", |
8145 NULL | 8153 NULL |
8146 }; | 8154 }; |
8147 // clang-format on | 8155 // clang-format on |
8148 | 8156 |
8149 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 8157 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; |
8150 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 8158 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
8151 arraysize(always_flags)); | 8159 arraysize(always_flags)); |
8152 } | 8160 } |
OLD | NEW |