Add lookahead restriction tests for "let [" in expression statement contexts

This commit is contained in:
André Bargull 2017-05-02 12:09:28 -07:00
parent 75d153d280
commit 7a86baee7d
25 changed files with 455 additions and 0 deletions

View File

@ -0,0 +1,20 @@
// 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: >
ExpressionStatement has a lookahead restriction for `let [`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
negative:
phase: early
type: SyntaxError
flags: [noStrict]
---*/
do let
[x] = 0
while (false);

View File

@ -0,0 +1,22 @@
// 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: >
ExpressionStatement has a lookahead restriction for `let [`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
negative:
phase: early
type: SyntaxError
flags: [noStrict]
features: [async-iteration]
---*/
async function* f() {
for await (var x of []) let
[a] = 0;
}

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-for-in-and-for-of-statements
description: >
ExpressionStatement doesn't have a lookahead restriction for `let {`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
features: [async-iteration]
---*/
async function* f() {
for await (var x of []) let // ASI
{}
}

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-for-in-and-for-of-statements
description: >
ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
features: [async-iteration]
---*/
async function* f() {
for await (var x of []) let // ASI
x = 1;
}

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-for-in-and-for-of-statements
description: >
ExpressionStatement has a lookahead restriction for `let [`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
negative:
phase: early
type: SyntaxError
flags: [noStrict]
---*/
for (var x in null) let
[a] = 0;

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let {`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
for (var x in null) let // ASI
{}

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
for (var x in null) let // ASI
x = 1;

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-for-in-and-for-of-statements
description: >
ExpressionStatement has a lookahead restriction for `let [`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
negative:
phase: early
type: SyntaxError
flags: [noStrict]
---*/
for (var x of []) let
[a] = 0;

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let {`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
for (var x of []) let // ASI
{}

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
for (var x of []) let // ASI
x = 1;

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-for-statement
description: >
ExpressionStatement has a lookahead restriction for `let [`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
negative:
phase: early
type: SyntaxError
flags: [noStrict]
---*/
for (; false; ) let
[a] = 0;

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let {`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
for (; false; ) let // ASI
{}

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
for (; false; ) let // ASI
x = 1;

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-if-statement
description: >
ExpressionStatement has a lookahead restriction for `let [`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
negative:
phase: early
type: SyntaxError
flags: [noStrict]
---*/
if (false) let
[a] = 0;

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let {`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
if (false) let // ASI
{}

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
if (false) let // ASI
x = 1;

View File

@ -0,0 +1,22 @@
// 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: >
ExpressionStatement has a lookahead restriction for `let [`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
negative:
phase: early
type: SyntaxError
flags: [noStrict]
---*/
// Wrapped in an if-statement to avoid reference errors at runtime.
if (false) {
L: let
[a] = 0;
}

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-labelled-statements
description: >
ExpressionStatement doesn't have a lookahead restriction for `let {`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
// Wrapped in an if-statement to avoid reference errors at runtime.
if (false) {
L: let // ASI
{}
}

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-labelled-statements
description: >
ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
// Wrapped in an if-statement to avoid reference errors at runtime.
if (false) {
L: let // ASI
x = 1;
}

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-while-statement
description: >
ExpressionStatement has a lookahead restriction for `let [`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
negative:
phase: early
type: SyntaxError
flags: [noStrict]
---*/
while (false) let
[a] = 0;

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let {`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
while (false) let // ASI
{}

View File

@ -0,0 +1,16 @@
// 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: >
ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
while (false) let // ASI
x = 1;

View File

@ -0,0 +1,22 @@
// 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: >
ExpressionStatement has a lookahead restriction for `let [`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
negative:
phase: early
type: SyntaxError
flags: [noStrict]
---*/
// Wrapped in an if-statement to avoid reference errors at runtime.
if (false) {
with ({}) let
[a] = 0;
}

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: >
ExpressionStatement doesn't have a lookahead restriction for `let {`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
// Wrapped in an if-statement to avoid reference errors at runtime.
if (false) {
with ({}) let // ASI
{}
}

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: >
ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
info: |
ExpressionStatement[Yield, Await] :
[lookahead { {, function, async [no LineTerminator here] function, class, let [ }]
Expression[+In, ?Yield, ?Await] ;
flags: [noStrict]
---*/
// Wrapped in an if-statement to avoid reference errors at runtime.
if (false) {
with ({}) let // ASI
x = 1;
}