Expand tests for duplicate lexical names of vardeclarednames in the same statementlist

This commit is contained in:
Leo Balter 2018-12-03 15:02:09 -05:00 committed by Rick Waldron
parent 3703d2bad1
commit 20c38d3396
18 changed files with 282 additions and 38 deletions

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-2-to-
name: VariableDeclaration in a BlockStatement inside a BlockStatement
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
Static Semantics: VarDeclaredNames
Block : { }
1. Return a new empty List.
StatementList : StatementList StatementListItem
1. Let names be VarDeclaredNames of StatementList.
2. Append to names the elements of the VarDeclaredNames of StatementListItem.
3. Return names.
StatementListItem : Declaration
1. Return a new empty List.
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
{ /*{ body }*/ { var f; } }

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-to-
name: VariableDeclaration in a BlockStatement inside a BlockStatement
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
Static Semantics: VarDeclaredNames
Block : { }
1. Return a new empty List.
StatementList : StatementList StatementListItem
1. Let names be VarDeclaredNames of StatementList.
2. Append to names the elements of the VarDeclaredNames of StatementListItem.
3. Return names.
StatementListItem : Declaration
1. Return a new empty List.
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
{ { var f; } /*{ body }*/ }

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.
/*---
path: language/block-scope/syntax/redeclaration/var-declaration-attempt-2-to-
name: VariableDeclaration in BlockStatement
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
{ /*{ body }*/; var f; }

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/block-scope/syntax/redeclaration/fn-scope-var-declaration-attempt-to-
name: VariableDeclaration in BlockStatement inside a function
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function x() {
{ /*{ body }*/; var f; }
}

View File

@ -0,0 +1,31 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-to-
name: VariableDeclaration in a BlockStatement inside a BlockStatement
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
Static Semantics: VarDeclaredNames
Block : { }
1. Return a new empty List.
StatementList : StatementList StatementListItem
1. Let names be VarDeclaredNames of StatementList.
2. Append to names the elements of the VarDeclaredNames of StatementListItem.
3. Return names.
StatementListItem : Declaration
1. Return a new empty List.
---*/
{ { var f; } /*{ body }*/ }

View File

@ -0,0 +1,17 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/block-scope/syntax/redeclaration/fn-scope-var-declaration-attempt-to-
name: VariableDeclaration in BlockStatement inside a function
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
---*/
function x() {
{ var f; /*{ body }*/ }
}

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-2-to-
name: VariableDeclaration in a BlockStatement inside a BlockStatement
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
Static Semantics: VarDeclaredNames
Block : { }
1. Return a new empty List.
StatementList : StatementList StatementListItem
1. Let names be VarDeclaredNames of StatementList.
2. Append to names the elements of the VarDeclaredNames of StatementListItem.
3. Return names.
StatementListItem : Declaration
1. Return a new empty List.
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
{ /*{ body }*/; { var f; } }

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-to-
name: VariableDeclaration in a BlockStatement inside a BlockStatement
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
Static Semantics: VarDeclaredNames
Block : { }
1. Return a new empty List.
StatementList : StatementList StatementListItem
1. Let names be VarDeclaredNames of StatementList.
2. Append to names the elements of the VarDeclaredNames of StatementListItem.
3. Return names.
StatementListItem : Declaration
1. Return a new empty List.
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
{ { var f; } /*{ body }*/; }

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.
/*---
path: language/block-scope/syntax/redeclaration/var-declaration-attempt-2-to-
name: VariableDeclaration in BlockStatement
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
{ /*{ body }*/; var f; }

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/block-scope/syntax/redeclaration/fn-scope-var-declaration-attempt-to-
name: VariableDeclaration in BlockStatement inside a function
esid: sec-block-static-semantics-early-errors
info: |
Block : { StatementList }
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
function x() {
{ /*{ body }*/; var f; }
}

View File

@ -11,6 +11,5 @@ negative:
$DONOTEVALUATE();
var a;
throw NotEarlyError;
for (a = 0 in {});
for (a = 0 in {});

View File

@ -10,6 +10,6 @@ negative:
---*/
$DONOTEVALUATE();
throw NotEarlyError;
for (const a = 0 in {});

View File

@ -10,6 +10,6 @@ negative:
---*/
$DONOTEVALUATE();
throw NotEarlyError;
for (let a = 0 in {});

View File

@ -11,6 +11,5 @@ flags: [onlyStrict]
---*/
$DONOTEVALUATE();
throw NotEarlyError;
for (var a = 0 in {});
for (var a = 0 in {});

View File

@ -10,6 +10,5 @@ negative:
---*/
$DONOTEVALUATE();
throw NotEarlyError;
for (var [a] = 0 in {});
for (var [a] = 0 in {});

View File

@ -10,6 +10,6 @@ negative:
---*/
$DONOTEVALUATE();
throw NotEarlyError;
for (var {a} = 0 in {});

View File

@ -1,14 +0,0 @@
// Copyright (C) 2011 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: B.3.3
description: >
redeclaration within block:
attempt to redeclare let binding with function declaration
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
{ let f; function f() {} }

View File

@ -1,15 +0,0 @@
// Copyright (C) 2011 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: B.3.3
description: >
redeclaration within block:
attempt to redeclare let binding with var
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
{ let f; var f; }