mirror of
https://github.com/tc39/test262.git
synced 2025-07-24 22:45:10 +02:00
Add tests to ensure async-functions/generators are not accepted in statement position
This commit is contained in:
parent
69735fd832
commit
75d153d280
18
test/language/statements/do-while/decl-async-fun.js
Normal file
18
test/language/statements/do-while/decl-async-fun.js
Normal file
@ -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)
|
18
test/language/statements/do-while/decl-async-gen.js
Normal file
18
test/language/statements/do-while/decl-async-gen.js
Normal file
@ -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)
|
18
test/language/statements/for-in/decl-async-fun.js
Normal file
18
test/language/statements/for-in/decl-async-fun.js
Normal file
@ -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() {}
|
18
test/language/statements/for-in/decl-async-gen.js
Normal file
18
test/language/statements/for-in/decl-async-gen.js
Normal file
@ -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() {}
|
18
test/language/statements/for-of/decl-async-fun.js
Normal file
18
test/language/statements/for-of/decl-async-fun.js
Normal file
@ -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() {}
|
18
test/language/statements/for-of/decl-async-gen.js
Normal file
18
test/language/statements/for-of/decl-async-gen.js
Normal file
@ -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() {}
|
18
test/language/statements/for/decl-async-fun.js
Normal file
18
test/language/statements/for/decl-async-fun.js
Normal file
@ -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() {}
|
18
test/language/statements/for/decl-async-gen.js
Normal file
18
test/language/statements/for/decl-async-gen.js
Normal file
@ -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() {}
|
18
test/language/statements/if/if-async-fun-else-async-fun.js
Normal file
18
test/language/statements/if/if-async-fun-else-async-fun.js
Normal file
@ -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() {}
|
18
test/language/statements/if/if-async-fun-else-stmt.js
Normal file
18
test/language/statements/if/if-async-fun-else-stmt.js
Normal file
@ -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 ;
|
18
test/language/statements/if/if-async-fun-no-else.js
Normal file
18
test/language/statements/if/if-async-fun-no-else.js
Normal file
@ -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() { }
|
18
test/language/statements/if/if-async-gen-else-async-gen.js
Normal file
18
test/language/statements/if/if-async-gen-else-async-gen.js
Normal file
@ -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() {}
|
18
test/language/statements/if/if-async-gen-else-stmt.js
Normal file
18
test/language/statements/if/if-async-gen-else-stmt.js
Normal file
@ -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 ;
|
18
test/language/statements/if/if-async-gen-no-else.js
Normal file
18
test/language/statements/if/if-async-gen-no-else.js
Normal file
@ -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() { }
|
18
test/language/statements/if/if-stmt-else-async-fun.js
Normal file
18
test/language/statements/if/if-stmt-else-async-fun.js
Normal file
@ -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() { }
|
18
test/language/statements/if/if-stmt-else-async-gen.js
Normal file
18
test/language/statements/if/if-stmt-else-async-gen.js
Normal file
@ -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() { }
|
18
test/language/statements/labeled/decl-async-function.js
Normal file
18
test/language/statements/labeled/decl-async-function.js
Normal file
@ -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() {}
|
18
test/language/statements/labeled/decl-async-generator.js
Normal file
18
test/language/statements/labeled/decl-async-generator.js
Normal file
@ -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() {}
|
18
test/language/statements/while/decl-async-fun.js
Normal file
18
test/language/statements/while/decl-async-fun.js
Normal file
@ -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() {}
|
18
test/language/statements/while/decl-async-gen.js
Normal file
18
test/language/statements/while/decl-async-gen.js
Normal file
@ -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() {}
|
19
test/language/statements/with/decl-async-fun.js
Normal file
19
test/language/statements/with/decl-async-fun.js
Normal file
@ -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() {}
|
19
test/language/statements/with/decl-async-gen.js
Normal file
19
test/language/statements/with/decl-async-gen.js
Normal file
@ -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…
x
Reference in New Issue
Block a user