mirror of https://github.com/tc39/test262.git
Add tests for the behavior of |let <newline> await| in normal and async functions.
This commit is contained in:
parent
230f9fc568
commit
6fe9488ec7
|
@ -0,0 +1,23 @@
|
|||
// 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` must not be considered a permissible binding name in
|
||||
LexicalDeclaration as used in async functions.
|
||||
info: >
|
||||
LexicalDeclaration is parametrized to indicate whether `async` is permitted as
|
||||
binding name. In async functions `await` is excluded from LexicalDeclaration
|
||||
as a binding name. Therefore ASI *can* apply between `let` (where a
|
||||
LexicalDeclaration is permitted) and `await`, so a subsequent `0` forms part
|
||||
of an AwaitExpression and there is no syntax error.
|
||||
---*/
|
||||
|
||||
async function f() {
|
||||
let
|
||||
await 0;
|
||||
}
|
||||
|
||||
assert(f instanceof Function);
|
|
@ -0,0 +1,24 @@
|
|||
// 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` must be considered a permissible binding name in LexicalDeclaration as
|
||||
used in non-async functions.
|
||||
info: >
|
||||
LexicalDeclaration is parametrized to indicate whether `async` is permitted as
|
||||
binding name. In non-async functions `await` is a perfectly cromulent binding
|
||||
name. Therefore ASI can't apply between `let` (where a LexicalDeclaration is
|
||||
permitted) and `await`, so a subsequent `0` where `=` was expected is a syntax
|
||||
error.
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
function f() {
|
||||
let
|
||||
await 0;
|
||||
}
|
Loading…
Reference in New Issue