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 7486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7497 "var asyncFn = async function() { await 1; };", | 7497 "var asyncFn = async function() { await 1; };", |
7498 "var asyncFn = async function withName() { await 1; };", | 7498 "var asyncFn = async function withName() { await 1; };", |
7499 "var asyncFn = async () => await 'test';", | 7499 "var asyncFn = async () => await 'test';", |
7500 "var asyncFn = async x => await x + 'test';", | 7500 "var asyncFn = async x => await x + 'test';", |
7501 "async function asyncFn() { await 1; }", | 7501 "async function asyncFn() { await 1; }", |
7502 "var O = { async method() { await 1; } }", | 7502 "var O = { async method() { await 1; } }", |
7503 "var O = { async ['meth' + 'od']() { await 1; } }", | 7503 "var O = { async ['meth' + 'od']() { await 1; } }", |
7504 "var O = { async 'method'() { await 1; } }", | 7504 "var O = { async 'method'() { await 1; } }", |
7505 "var O = { async 0() { await 1; } }", | 7505 "var O = { async 0() { await 1; } }", |
7506 "async function await() {}", | 7506 "async function await() {}", |
7507 | |
7508 "var asyncFn = async({ foo = 1 }) => foo;", | |
7509 "var asyncFn = async({ foo = 1 } = {}) => foo;", | |
7507 NULL | 7510 NULL |
7508 }; | 7511 }; |
7509 // clang-format on | 7512 // clang-format on |
7510 | 7513 |
7511 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; | 7514 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; |
7512 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | 7515 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
7513 arraysize(always_flags)); | 7516 arraysize(always_flags)); |
7514 | 7517 |
7515 // clang-format off | 7518 // clang-format off |
7516 const char* async_body_context_data[][2] = { | 7519 const char* async_body_context_data[][2] = { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7658 "(async['foo'] () => 1)", | 7661 "(async['foo'] () => 1)", |
7659 "(async()['foo'] => 1)", | 7662 "(async()['foo'] => 1)", |
7660 "(async()['foo'] foo => 1)", | 7663 "(async()['foo'] foo => 1)", |
7661 "(async()['foo'] () => 1)", | 7664 "(async()['foo'] () => 1)", |
7662 "(async`foo` => 1)", | 7665 "(async`foo` => 1)", |
7663 "(async`foo` foo => 1)", | 7666 "(async`foo` foo => 1)", |
7664 "(async`foo` () => 1)", | 7667 "(async`foo` () => 1)", |
7665 "(async`foo`.bar => 1)", | 7668 "(async`foo`.bar => 1)", |
7666 "(async`foo`.bar foo => 1)", | 7669 "(async`foo`.bar foo => 1)", |
7667 "(async`foo`.bar () => 1)", | 7670 "(async`foo`.bar () => 1)", |
7671 | |
7672 // v8:5148 assert that errors are still thrown for calls that may have been | |
7673 // async functions | |
7674 "async({ foo = 1 })", | |
Dan Ehrenberg
2016/06/24 17:30:41
Maybe verify that await is banned in this context
caitp (gmail)
2016/06/24 18:05:40
why would await be banned in this context, other t
Dan Ehrenberg
2016/06/24 18:30:14
test-parsing.cc has a way of invoking just the par
caitp (gmail)
2016/06/24 19:24:43
I've added tests and a TODO, will deal with fixing
| |
7668 NULL | 7675 NULL |
7669 }; | 7676 }; |
7670 | 7677 |
7671 const char* strict_error_data[] = { | 7678 const char* strict_error_data[] = { |
7672 "var O = { async method(eval) {} }", | 7679 "var O = { async method(eval) {} }", |
7673 "var O = { async ['meth' + 'od'](eval) {} }", | 7680 "var O = { async ['meth' + 'od'](eval) {} }", |
7674 "var O = { async 'method'(eval) {} }", | 7681 "var O = { async 'method'(eval) {} }", |
7675 "var O = { async 0(eval) {} }", | 7682 "var O = { async 0(eval) {} }", |
7676 | 7683 |
7677 "var O = { async method(arguments) {} }", | 7684 "var O = { async method(arguments) {} }", |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7807 NULL}; | 7814 NULL}; |
7808 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; | 7815 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; |
7809 // The preparser doesn't enforce the restriction, so turn it off. | 7816 // The preparser doesn't enforce the restriction, so turn it off. |
7810 bool test_preparser = false; | 7817 bool test_preparser = false; |
7811 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0, | 7818 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0, |
7812 always_flags, arraysize(always_flags), NULL, 0, false, | 7819 always_flags, arraysize(always_flags), NULL, 0, false, |
7813 test_preparser); | 7820 test_preparser); |
7814 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0, | 7821 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0, |
7815 always_flags, arraysize(always_flags)); | 7822 always_flags, arraysize(always_flags)); |
7816 } | 7823 } |
OLD | NEW |