Add tests to ensure async-functions/generators are not accepted in statement position

This commit is contained in:
André Bargull 2017-05-02 12:09:27 -07:00
parent 69735fd832
commit 75d153d280
22 changed files with 398 additions and 0 deletions

View 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)

View 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)

View 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() {}

View 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() {}

View 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() {}

View 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() {}

View 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() {}

View 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() {}

View 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() {}

View 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 ;

View 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() { }

View 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() {}

View 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 ;

View 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() { }

View 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() { }

View 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() { }

View 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() {}

View 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() {}

View 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() {}

View 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() {}

View 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() {}

View 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() {}