mirror of https://github.com/tc39/test262.git
Add tests to ensure async-functions/generators are not accepted in statement position
This commit is contained in:
parent
69735fd832
commit
75d153d280
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-do-while-statement
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
do async function f() {} while (false)
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-do-while-statement
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
do async function* g() {} while (false)
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-for-in-and-for-of-statements
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
for (var x in {}) async function f() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-for-in-and-for-of-statements
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
for (var x in {}) async function* g() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-for-in-and-for-of-statements
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
for (var x of []) async function f() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-for-in-and-for-of-statements
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
for (var x of []) async function* g() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-for-statement
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
for ( ; false; ) async function f() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-for-statement
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
for ( ; false; ) async function* g() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-if-statement
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
if (true) async function f() { } else async function _f() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-if-statement
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
if (true) async function f() { } else ;
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-if-statement
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
if (true) async function f() { }
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-if-statement
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
if (true) async function* f() { } else async function* _f() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-if-statement
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
if (true) async function* f() { } else ;
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-if-statement
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
if (true) async function* f() { }
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-if-statement
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
if (false) ; else async function f() { }
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-if-statement
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
if (false) ; else async function* f() { }
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-labelled-statements
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
label: async function f() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-labelled-statements
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
label: async function* g() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-while-statement
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
---*/
|
||||
|
||||
while (false) async function f() {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-while-statement
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
---*/
|
||||
|
||||
while (false) async function* g() {}
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-with-statement
|
||||
description: >
|
||||
AsyncFunctionDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-functions]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
with ({}) async function f() {}
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2017 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-with-statement
|
||||
description: >
|
||||
AsyncGeneratorDeclaration is not allowed in statement position
|
||||
info: |
|
||||
ExpressionStatement[Yield, Await] :
|
||||
[lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
|
||||
Expression[+In, ?Yield, ?Await] ;
|
||||
negative:
|
||||
phase: early
|
||||
type: SyntaxError
|
||||
features: [async-iteration]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
with ({}) async function* g() {}
|
Loading…
Reference in New Issue