diff options
author | Martok <martok@martoks-place.de> | 2022-06-17 21:02:38 +0200 |
---|---|---|
committer | Martok <martok@martoks-place.de> | 2022-06-17 21:02:38 +0200 |
commit | a492c5bdb9802cf235ad69b879dd50aee6105c5f (patch) | |
tree | 9ee87624c5be943494a41619bdfcd89956acae54 /js/src/tests | |
parent | 5d0bc8e811c9a4fb206dbda9667e07c970fd0a26 (diff) | |
download | uxp-a492c5bdb9802cf235ad69b879dd50aee6105c5f.tar.gz |
Issue #1918 - m-c 1353690: Properly exclude |await| from consideration as a |let| variable name in async functions, so that a newline between the two separates them into two distinct expressions.
Diffstat (limited to 'js/src/tests')
-rw-r--r-- | js/src/tests/test262/local/let-newline-await-in-async-function.js | 18 | ||||
-rw-r--r-- | js/src/tests/test262/local/let-newline-await-in-normal-function.js | 20 |
2 files changed, 38 insertions, 0 deletions
diff --git a/js/src/tests/test262/local/let-newline-await-in-async-function.js b/js/src/tests/test262/local/let-newline-await-in-async-function.js new file mode 100644 index 0000000000..c43a5b2745 --- /dev/null +++ b/js/src/tests/test262/local/let-newline-await-in-async-function.js @@ -0,0 +1,18 @@ +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Jeff Walden <jwalden+code@mit.edu> +esid: sec-let-and-const-declarations +description: > + |await| is excluded from LexicalDeclaration by grammar parameter, in + AsyncFunction. Therefore |let| followed by |await| inside AsyncFunction is + an ASI opportunity, and this code must parse without error. +---*/ + +async function f() { + let + await 0; +} + +reportCompare(true, f instanceof Function); diff --git a/js/src/tests/test262/local/let-newline-await-in-normal-function.js b/js/src/tests/test262/local/let-newline-await-in-normal-function.js new file mode 100644 index 0000000000..f49f9ea528 --- /dev/null +++ b/js/src/tests/test262/local/let-newline-await-in-normal-function.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Jeff Walden <jwalden+code@mit.edu> +esid: sec-let-and-const-declarations +description: > + Outside AsyncFunction, |await| is a perfectly cromulent LexicalDeclaration + variable name. Therefore ASI doesn't apply, and so the |0| where a |=| was + expected is a syntax error. +negative: + phase: early + type: SyntaxError +---*/ + +function f() { + let + await 0; +} |