From 62857dcba7c04a4fac7397d92d18032d6e27f270 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Wed, 10 Feb 2016 09:03:09 -0500 Subject: [PATCH 1/2] Rename IterationStatement tests - Prefix file names to explicitly describe the "head" position - Remove statement name suffix as this information is reflected by each file's location within the file hierarchy --- ...ordecl-tdz-for-in.js => head-const-bound-names-fordecl-tdz.js} | 0 ...ration-for-in.js => head-const-fresh-binding-per-iteration.js} | 0 ...-fordecl-tdz-for-in.js => head-let-bound-names-fordecl-tdz.js} | 0 ...teration-for-in.js => head-let-fresh-binding-per-iteration.js} | 0 ...ordecl-tdz-for-of.js => head-const-bound-names-fordecl-tdz.js} | 0 ...ration-for-of.js => head-const-fresh-binding-per-iteration.js} | 0 ...-fordecl-tdz-for-of.js => head-let-bound-names-fordecl-tdz.js} | 0 ...teration-for-of.js => head-let-fresh-binding-per-iteration.js} | 0 ...iteration-for.js => head-const-fresh-binding-per-iteration.js} | 0 ...r-iteration-for.js => head-let-fresh-binding-per-iteration.js} | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename test/language/statements/for-in/{const-bound-names-fordecl-tdz-for-in.js => head-const-bound-names-fordecl-tdz.js} (100%) rename test/language/statements/for-in/{const-fresh-binding-per-iteration-for-in.js => head-const-fresh-binding-per-iteration.js} (100%) rename test/language/statements/for-in/{let-bound-names-fordecl-tdz-for-in.js => head-let-bound-names-fordecl-tdz.js} (100%) rename test/language/statements/for-in/{let-fresh-binding-per-iteration-for-in.js => head-let-fresh-binding-per-iteration.js} (100%) rename test/language/statements/for-of/{const-bound-names-fordecl-tdz-for-of.js => head-const-bound-names-fordecl-tdz.js} (100%) rename test/language/statements/for-of/{const-fresh-binding-per-iteration-for-of.js => head-const-fresh-binding-per-iteration.js} (100%) rename test/language/statements/for-of/{let-bound-names-fordecl-tdz-for-of.js => head-let-bound-names-fordecl-tdz.js} (100%) rename test/language/statements/for-of/{let-fresh-binding-per-iteration-for-of.js => head-let-fresh-binding-per-iteration.js} (100%) rename test/language/statements/for/{const-fresh-binding-per-iteration-for.js => head-const-fresh-binding-per-iteration.js} (100%) rename test/language/statements/for/{let-fresh-binding-per-iteration-for.js => head-let-fresh-binding-per-iteration.js} (100%) diff --git a/test/language/statements/for-in/const-bound-names-fordecl-tdz-for-in.js b/test/language/statements/for-in/head-const-bound-names-fordecl-tdz.js similarity index 100% rename from test/language/statements/for-in/const-bound-names-fordecl-tdz-for-in.js rename to test/language/statements/for-in/head-const-bound-names-fordecl-tdz.js diff --git a/test/language/statements/for-in/const-fresh-binding-per-iteration-for-in.js b/test/language/statements/for-in/head-const-fresh-binding-per-iteration.js similarity index 100% rename from test/language/statements/for-in/const-fresh-binding-per-iteration-for-in.js rename to test/language/statements/for-in/head-const-fresh-binding-per-iteration.js diff --git a/test/language/statements/for-in/let-bound-names-fordecl-tdz-for-in.js b/test/language/statements/for-in/head-let-bound-names-fordecl-tdz.js similarity index 100% rename from test/language/statements/for-in/let-bound-names-fordecl-tdz-for-in.js rename to test/language/statements/for-in/head-let-bound-names-fordecl-tdz.js diff --git a/test/language/statements/for-in/let-fresh-binding-per-iteration-for-in.js b/test/language/statements/for-in/head-let-fresh-binding-per-iteration.js similarity index 100% rename from test/language/statements/for-in/let-fresh-binding-per-iteration-for-in.js rename to test/language/statements/for-in/head-let-fresh-binding-per-iteration.js diff --git a/test/language/statements/for-of/const-bound-names-fordecl-tdz-for-of.js b/test/language/statements/for-of/head-const-bound-names-fordecl-tdz.js similarity index 100% rename from test/language/statements/for-of/const-bound-names-fordecl-tdz-for-of.js rename to test/language/statements/for-of/head-const-bound-names-fordecl-tdz.js diff --git a/test/language/statements/for-of/const-fresh-binding-per-iteration-for-of.js b/test/language/statements/for-of/head-const-fresh-binding-per-iteration.js similarity index 100% rename from test/language/statements/for-of/const-fresh-binding-per-iteration-for-of.js rename to test/language/statements/for-of/head-const-fresh-binding-per-iteration.js diff --git a/test/language/statements/for-of/let-bound-names-fordecl-tdz-for-of.js b/test/language/statements/for-of/head-let-bound-names-fordecl-tdz.js similarity index 100% rename from test/language/statements/for-of/let-bound-names-fordecl-tdz-for-of.js rename to test/language/statements/for-of/head-let-bound-names-fordecl-tdz.js diff --git a/test/language/statements/for-of/let-fresh-binding-per-iteration-for-of.js b/test/language/statements/for-of/head-let-fresh-binding-per-iteration.js similarity index 100% rename from test/language/statements/for-of/let-fresh-binding-per-iteration-for-of.js rename to test/language/statements/for-of/head-let-fresh-binding-per-iteration.js diff --git a/test/language/statements/for/const-fresh-binding-per-iteration-for.js b/test/language/statements/for/head-const-fresh-binding-per-iteration.js similarity index 100% rename from test/language/statements/for/const-fresh-binding-per-iteration-for.js rename to test/language/statements/for/head-const-fresh-binding-per-iteration.js diff --git a/test/language/statements/for/let-fresh-binding-per-iteration-for.js b/test/language/statements/for/head-let-fresh-binding-per-iteration.js similarity index 100% rename from test/language/statements/for/let-fresh-binding-per-iteration-for.js rename to test/language/statements/for/head-let-fresh-binding-per-iteration.js From 4dd2d9b7eec489c18a3a7a2eddac97f6b0650cf4 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 9 Feb 2016 16:38:11 -0500 Subject: [PATCH 2/2] Add tests for IterationStatement early errors --- .../statements/do-while/labeled-fn-stmt.js | 14 +++++++++++++ .../for-in/head-const-bound-names-dup.js | 13 ++++++++++++ .../for-in/head-const-bound-names-in-stmt.js | 15 ++++++++++++++ .../for-in/head-const-bound-names-let.js | 13 ++++++++++++ .../for-in/head-let-bound-names-dup.js | 13 ++++++++++++ .../for-in/head-let-bound-names-in-stmt.js | 15 ++++++++++++++ .../for-in/head-let-bound-names-let.js | 13 ++++++++++++ .../for-in/head-lhs-cover-non-asnmt-trgt.js | 20 +++++++++++++++++++ .../statements/for-in/head-lhs-cover.js | 19 ++++++++++++++++++ .../for-in/head-lhs-invalid-asnmt-ptrn-ary.js | 16 +++++++++++++++ .../for-in/head-lhs-invalid-asnmt-ptrn-obj.js | 16 +++++++++++++++ .../statements/for-in/head-lhs-member.js | 19 ++++++++++++++++++ .../for-in/head-lhs-non-asnmt-trgt.js | 14 +++++++++++++ .../for-in/head-var-bound-names-dup.js | 17 ++++++++++++++++ .../for-in/head-var-bound-names-in-stmt.js | 18 +++++++++++++++++ .../for-in/head-var-bound-names-let.js | 18 +++++++++++++++++ .../for-in/labeled-fn-stmt-const.js | 14 +++++++++++++ .../statements/for-in/labeled-fn-stmt-let.js | 14 +++++++++++++ .../statements/for-in/labeled-fn-stmt-lhs.js | 14 +++++++++++++ .../statements/for-in/labeled-fn-stmt-var.js | 14 +++++++++++++ .../for-of/head-const-bound-names-dup.js | 13 ++++++++++++ .../for-of/head-const-bound-names-in-stmt.js | 15 ++++++++++++++ .../for-of/head-const-bound-names-let.js | 13 ++++++++++++ .../for-of/head-let-bound-names-dup.js | 13 ++++++++++++ .../for-of/head-let-bound-names-in-stmt.js | 15 ++++++++++++++ .../for-of/head-let-bound-names-let.js | 13 ++++++++++++ .../for-of/head-lhs-cover-non-asnmt-trgt.js | 20 +++++++++++++++++++ .../statements/for-of/head-lhs-cover.js | 19 ++++++++++++++++++ .../for-of/head-lhs-invalid-asnmt-ptrn-ary.js | 16 +++++++++++++++ .../for-of/head-lhs-invalid-asnmt-ptrn-obj.js | 16 +++++++++++++++ .../statements/for-of/head-lhs-member.js | 19 ++++++++++++++++++ .../for-of/head-lhs-non-asnmt-trgt.js | 14 +++++++++++++ .../for-of/head-var-bound-names-dup.js | 17 ++++++++++++++++ .../for-of/head-var-bound-names-in-stmt.js | 18 +++++++++++++++++ .../for-of/head-var-bound-names-let.js | 18 +++++++++++++++++ .../for-of/labeled-fn-stmt-const.js | 14 +++++++++++++ .../statements/for-of/labeled-fn-stmt-let.js | 14 +++++++++++++ .../statements/for-of/labeled-fn-stmt-lhs.js | 14 +++++++++++++ .../statements/for-of/labeled-fn-stmt-var.js | 14 +++++++++++++ .../for/head-const-bound-names-in-stmt.js | 18 +++++++++++++++++ .../for/head-let-bound-names-in-stmt.js | 18 +++++++++++++++++ .../for/head-var-bound-names-in-stmt.js | 17 ++++++++++++++++ .../statements/for/labeled-fn-stmt-const.js | 14 +++++++++++++ .../statements/for/labeled-fn-stmt-expr.js | 14 +++++++++++++ .../statements/for/labeled-fn-stmt-let.js | 14 +++++++++++++ .../statements/for/labeled-fn-stmt-var.js | 14 +++++++++++++ .../statements/while/labeled-fn-stmt.js | 14 +++++++++++++ 47 files changed, 727 insertions(+) create mode 100644 test/language/statements/do-while/labeled-fn-stmt.js create mode 100644 test/language/statements/for-in/head-const-bound-names-dup.js create mode 100644 test/language/statements/for-in/head-const-bound-names-in-stmt.js create mode 100644 test/language/statements/for-in/head-const-bound-names-let.js create mode 100644 test/language/statements/for-in/head-let-bound-names-dup.js create mode 100644 test/language/statements/for-in/head-let-bound-names-in-stmt.js create mode 100644 test/language/statements/for-in/head-let-bound-names-let.js create mode 100644 test/language/statements/for-in/head-lhs-cover-non-asnmt-trgt.js create mode 100644 test/language/statements/for-in/head-lhs-cover.js create mode 100644 test/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-ary.js create mode 100644 test/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-obj.js create mode 100644 test/language/statements/for-in/head-lhs-member.js create mode 100644 test/language/statements/for-in/head-lhs-non-asnmt-trgt.js create mode 100644 test/language/statements/for-in/head-var-bound-names-dup.js create mode 100644 test/language/statements/for-in/head-var-bound-names-in-stmt.js create mode 100644 test/language/statements/for-in/head-var-bound-names-let.js create mode 100644 test/language/statements/for-in/labeled-fn-stmt-const.js create mode 100644 test/language/statements/for-in/labeled-fn-stmt-let.js create mode 100644 test/language/statements/for-in/labeled-fn-stmt-lhs.js create mode 100644 test/language/statements/for-in/labeled-fn-stmt-var.js create mode 100644 test/language/statements/for-of/head-const-bound-names-dup.js create mode 100644 test/language/statements/for-of/head-const-bound-names-in-stmt.js create mode 100644 test/language/statements/for-of/head-const-bound-names-let.js create mode 100644 test/language/statements/for-of/head-let-bound-names-dup.js create mode 100644 test/language/statements/for-of/head-let-bound-names-in-stmt.js create mode 100644 test/language/statements/for-of/head-let-bound-names-let.js create mode 100644 test/language/statements/for-of/head-lhs-cover-non-asnmt-trgt.js create mode 100644 test/language/statements/for-of/head-lhs-cover.js create mode 100644 test/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-ary.js create mode 100644 test/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-obj.js create mode 100644 test/language/statements/for-of/head-lhs-member.js create mode 100644 test/language/statements/for-of/head-lhs-non-asnmt-trgt.js create mode 100644 test/language/statements/for-of/head-var-bound-names-dup.js create mode 100644 test/language/statements/for-of/head-var-bound-names-in-stmt.js create mode 100644 test/language/statements/for-of/head-var-bound-names-let.js create mode 100644 test/language/statements/for-of/labeled-fn-stmt-const.js create mode 100644 test/language/statements/for-of/labeled-fn-stmt-let.js create mode 100644 test/language/statements/for-of/labeled-fn-stmt-lhs.js create mode 100644 test/language/statements/for-of/labeled-fn-stmt-var.js create mode 100644 test/language/statements/for/head-const-bound-names-in-stmt.js create mode 100644 test/language/statements/for/head-let-bound-names-in-stmt.js create mode 100644 test/language/statements/for/head-var-bound-names-in-stmt.js create mode 100644 test/language/statements/for/labeled-fn-stmt-const.js create mode 100644 test/language/statements/for/labeled-fn-stmt-expr.js create mode 100644 test/language/statements/for/labeled-fn-stmt-let.js create mode 100644 test/language/statements/for/labeled-fn-stmt-var.js create mode 100644 test/language/statements/while/labeled-fn-stmt.js diff --git a/test/language/statements/do-while/labeled-fn-stmt.js b/test/language/statements/do-while/labeled-fn-stmt.js new file mode 100644 index 0000000000..0469dc9b8f --- /dev/null +++ b/test/language/statements/do-while/labeled-fn-stmt.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +do label1: label2: function f() {} while (false) diff --git a/test/language/statements/for-in/head-const-bound-names-dup.js b/test/language/statements/for-in/head-const-bound-names-dup.js new file mode 100644 index 0000000000..a0afd41eb1 --- /dev/null +++ b/test/language/statements/for-in/head-const-bound-names-dup.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The head's declaration may not contain duplicate entries +negative: SyntaxError +info: | + It is a Syntax Error if the BoundNames of ForDeclaration contains any + duplicate entries. +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +---*/ + +for (const [x, x] in {}) {} diff --git a/test/language/statements/for-in/head-const-bound-names-in-stmt.js b/test/language/statements/for-in/head-const-bound-names-in-stmt.js new file mode 100644 index 0000000000..3f8001633e --- /dev/null +++ b/test/language/statements/for-in/head-const-bound-names-in-stmt.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The body may not re-declare variables declared in the head +negative: SyntaxError +info: | + It is a Syntax Error if any element of the BoundNames of ForDeclaration + also occurs in the VarDeclaredNames of Statement. +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +---*/ + +for (const x in {}) { + var x; +} diff --git a/test/language/statements/for-in/head-const-bound-names-let.js b/test/language/statements/for-in/head-const-bound-names-let.js new file mode 100644 index 0000000000..ddaea955aa --- /dev/null +++ b/test/language/statements/for-in/head-const-bound-names-let.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The declaration may not contain a binding for `let` +negative: SyntaxError +info: | + It is a Syntax Error if the BoundNames of ForDeclaration contains "let". +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +flags: [noStrict] +---*/ + +for (const let in {}) {} diff --git a/test/language/statements/for-in/head-let-bound-names-dup.js b/test/language/statements/for-in/head-let-bound-names-dup.js new file mode 100644 index 0000000000..8e395f5f93 --- /dev/null +++ b/test/language/statements/for-in/head-let-bound-names-dup.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The head's declaration may not contain duplicate entries +negative: SyntaxError +info: | + It is a Syntax Error if the BoundNames of ForDeclaration contains any + duplicate entries. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +for (let [x, x] in {}) {} diff --git a/test/language/statements/for-in/head-let-bound-names-in-stmt.js b/test/language/statements/for-in/head-let-bound-names-in-stmt.js new file mode 100644 index 0000000000..219a7fd2e2 --- /dev/null +++ b/test/language/statements/for-in/head-let-bound-names-in-stmt.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The body may not re-declare variables declared in the head +negative: SyntaxError +info: | + It is a Syntax Error if any element of the BoundNames of ForDeclaration + also occurs in the VarDeclaredNames of Statement. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +for (let x in {}) { + var x; +} diff --git a/test/language/statements/for-in/head-let-bound-names-let.js b/test/language/statements/for-in/head-let-bound-names-let.js new file mode 100644 index 0000000000..d70fbc5e9b --- /dev/null +++ b/test/language/statements/for-in/head-let-bound-names-let.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The declaration may not contain a binding for `let` +negative: SyntaxError +info: | + It is a Syntax Error if the BoundNames of ForDeclaration contains "let". +flags: [noStrict] +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +---*/ + +for (let let in {}) {} diff --git a/test/language/statements/for-in/head-lhs-cover-non-asnmt-trgt.js b/test/language/statements/for-in/head-lhs-cover-non-asnmt-trgt.js new file mode 100644 index 0000000000..ea340a318a --- /dev/null +++ b/test/language/statements/for-in/head-lhs-cover-non-asnmt-trgt.js @@ -0,0 +1,20 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Head's LeftHandSideExpression must be a simple assignment target +info: > + It is a Syntax Error if IsValidSimpleAssignmentTarget of + LeftHandSideExpression is false. + + It is a Syntax Error if the LeftHandSideExpression is + CoverParenthesizedExpressionAndArrowParameterList : ( Expression ) and + Expression derives a production that would produce a Syntax Error according + to these rules if that production is substituted for + LeftHandSideExpression. This rule is recursively applied. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for ((this) in {}) {} diff --git a/test/language/statements/for-in/head-lhs-cover.js b/test/language/statements/for-in/head-lhs-cover.js new file mode 100644 index 0000000000..f72f6ba4c8 --- /dev/null +++ b/test/language/statements/for-in/head-lhs-cover.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Head's AssignmentExpression may be CoverParenthesizedExpressionAndArrowParameterList +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +var iterCount = 0; +var x; + +for ((x) in { attr: null }) { + assert.sameValue(x, 'attr'); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-ary.js b/test/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-ary.js new file mode 100644 index 0000000000..460f9128e8 --- /dev/null +++ b/test/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-ary.js @@ -0,0 +1,16 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Invalid destructuring assignment pattern (array literal) +info: > + It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral + or an ArrayLiteral and if the lexical token sequence matched by + LeftHandSideExpression cannot be parsed with no tokens left over using + AssignmentPattern as the goal symbol. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for ([(x, y)] in {}) {} diff --git a/test/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-obj.js b/test/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-obj.js new file mode 100644 index 0000000000..871ebfb4aa --- /dev/null +++ b/test/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-obj.js @@ -0,0 +1,16 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Invalid destructuring assignment pattern (object literal) +info: > + It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral + or an ArrayLiteral and if the lexical token sequence matched by + LeftHandSideExpression cannot be parsed with no tokens left over using + AssignmentPattern as the goal symbol. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for ({ m() {} } in {}) {} diff --git a/test/language/statements/for-in/head-lhs-member.js b/test/language/statements/for-in/head-lhs-member.js new file mode 100644 index 0000000000..c9268a4a03 --- /dev/null +++ b/test/language/statements/for-in/head-lhs-member.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Head's AssignmentExpression may be a MemberExpression +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +var iterCount = 0; +var x = {}; + +for (x.y in { attr: null }) { + assert.sameValue(x.y, 'attr'); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-in/head-lhs-non-asnmt-trgt.js b/test/language/statements/for-in/head-lhs-non-asnmt-trgt.js new file mode 100644 index 0000000000..55e906093d --- /dev/null +++ b/test/language/statements/for-in/head-lhs-non-asnmt-trgt.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Head's LeftHandSideExpression must be a simple assignment target +info: > + It is a Syntax Error if IsValidSimpleAssignmentTarget of + LeftHandSideExpression is false. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (this in {}) {} diff --git a/test/language/statements/for-in/head-var-bound-names-dup.js b/test/language/statements/for-in/head-var-bound-names-dup.js new file mode 100644 index 0000000000..5172024418 --- /dev/null +++ b/test/language/statements/for-in/head-var-bound-names-dup.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: The head's declaration may contain duplicate entries +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +var iterCount = 0; + +for (var [x, x] in { ab: null }) { + assert.sameValue(x, 'b'); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-in/head-var-bound-names-in-stmt.js b/test/language/statements/for-in/head-var-bound-names-in-stmt.js new file mode 100644 index 0000000000..58e3180619 --- /dev/null +++ b/test/language/statements/for-in/head-var-bound-names-in-stmt.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The body may re-declare variables declared in the head +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +var iterCount = 0; + +for (var x in { attr: null }) { + var x; + + assert.sameValue(x, 'attr'); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-in/head-var-bound-names-let.js b/test/language/statements/for-in/head-var-bound-names-let.js new file mode 100644 index 0000000000..731541bfab --- /dev/null +++ b/test/language/statements/for-in/head-var-bound-names-let.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: The head's bound names may include "let" +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +flags: [noStrict] +---*/ + +var iterCount = 0; + +for (var let in { attr: null }) { + assert.sameValue(let, 'attr'); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-in/labeled-fn-stmt-const.js b/test/language/statements/for-in/labeled-fn-stmt-const.js new file mode 100644 index 0000000000..9feb0161cc --- /dev/null +++ b/test/language/statements/for-in/labeled-fn-stmt-const.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (const x in {}) label1: label2: function f() {} diff --git a/test/language/statements/for-in/labeled-fn-stmt-let.js b/test/language/statements/for-in/labeled-fn-stmt-let.js new file mode 100644 index 0000000000..6e2c24e0cf --- /dev/null +++ b/test/language/statements/for-in/labeled-fn-stmt-let.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (let x in {}) label1: label2: function f() {} diff --git a/test/language/statements/for-in/labeled-fn-stmt-lhs.js b/test/language/statements/for-in/labeled-fn-stmt-lhs.js new file mode 100644 index 0000000000..bc5f6490ce --- /dev/null +++ b/test/language/statements/for-in/labeled-fn-stmt-lhs.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (x in {}) label1: label2: function f() {} diff --git a/test/language/statements/for-in/labeled-fn-stmt-var.js b/test/language/statements/for-in/labeled-fn-stmt-var.js new file mode 100644 index 0000000000..25a17fe36f --- /dev/null +++ b/test/language/statements/for-in/labeled-fn-stmt-var.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (var x in {}) label1: label2: function f() {} diff --git a/test/language/statements/for-of/head-const-bound-names-dup.js b/test/language/statements/for-of/head-const-bound-names-dup.js new file mode 100644 index 0000000000..0fbfeeb269 --- /dev/null +++ b/test/language/statements/for-of/head-const-bound-names-dup.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The head's declaration may not contain duplicate entries +negative: SyntaxError +info: | + It is a Syntax Error if the BoundNames of ForDeclaration contains any + duplicate entries. +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +---*/ + +for (const [x, x] of []) {} diff --git a/test/language/statements/for-of/head-const-bound-names-in-stmt.js b/test/language/statements/for-of/head-const-bound-names-in-stmt.js new file mode 100644 index 0000000000..a9cafda4e3 --- /dev/null +++ b/test/language/statements/for-of/head-const-bound-names-in-stmt.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The body may not re-declare variables declared in the head +negative: SyntaxError +info: | + It is a Syntax Error if any element of the BoundNames of ForDeclaration + also occurs in the VarDeclaredNames of Statement. +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +---*/ + +for (const x of []) { + var x; +} diff --git a/test/language/statements/for-of/head-const-bound-names-let.js b/test/language/statements/for-of/head-const-bound-names-let.js new file mode 100644 index 0000000000..07b2cbfea9 --- /dev/null +++ b/test/language/statements/for-of/head-const-bound-names-let.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The declaration may not contain a binding for `let` +negative: SyntaxError +info: | + It is a Syntax Error if the BoundNames of ForDeclaration contains "let". +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +flags: [noStrict] +---*/ + +for (const let of []) {} diff --git a/test/language/statements/for-of/head-let-bound-names-dup.js b/test/language/statements/for-of/head-let-bound-names-dup.js new file mode 100644 index 0000000000..32bfb157b4 --- /dev/null +++ b/test/language/statements/for-of/head-let-bound-names-dup.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The head's declaration may not contain duplicate entries +negative: SyntaxError +info: | + It is a Syntax Error if the BoundNames of ForDeclaration contains any + duplicate entries. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +for (let [x, x] of []) {} diff --git a/test/language/statements/for-of/head-let-bound-names-in-stmt.js b/test/language/statements/for-of/head-let-bound-names-in-stmt.js new file mode 100644 index 0000000000..eababe1a3e --- /dev/null +++ b/test/language/statements/for-of/head-let-bound-names-in-stmt.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The body may not re-declare variables declared in the head +negative: SyntaxError +info: | + It is a Syntax Error if any element of the BoundNames of ForDeclaration + also occurs in the VarDeclaredNames of Statement. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +for (let x of []) { + var x; +} diff --git a/test/language/statements/for-of/head-let-bound-names-let.js b/test/language/statements/for-of/head-let-bound-names-let.js new file mode 100644 index 0000000000..bff8bdbf56 --- /dev/null +++ b/test/language/statements/for-of/head-let-bound-names-let.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The declaration may not contain a binding for `let` +negative: SyntaxError +info: | + It is a Syntax Error if the BoundNames of ForDeclaration contains "let". +flags: [noStrict] +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +---*/ + +for (let let of []) {} diff --git a/test/language/statements/for-of/head-lhs-cover-non-asnmt-trgt.js b/test/language/statements/for-of/head-lhs-cover-non-asnmt-trgt.js new file mode 100644 index 0000000000..7f7749ec79 --- /dev/null +++ b/test/language/statements/for-of/head-lhs-cover-non-asnmt-trgt.js @@ -0,0 +1,20 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Head's LeftHandSideExpression must be a simple assignment target +info: > + It is a Syntax Error if IsValidSimpleAssignmentTarget of + LeftHandSideExpression is false. + + It is a Syntax Error if the LeftHandSideExpression is + CoverParenthesizedExpressionAndArrowParameterList : ( Expression ) and + Expression derives a production that would produce a Syntax Error according + to these rules if that production is substituted for + LeftHandSideExpression. This rule is recursively applied. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for ((this) of []) {} diff --git a/test/language/statements/for-of/head-lhs-cover.js b/test/language/statements/for-of/head-lhs-cover.js new file mode 100644 index 0000000000..16ba60dc60 --- /dev/null +++ b/test/language/statements/for-of/head-lhs-cover.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Head's AssignmentExpression may be CoverParenthesizedExpressionAndArrowParameterList +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +var iterCount = 0; +var x; + +for ((x) of [23]) { + assert.sameValue(x, 23); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-ary.js b/test/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-ary.js new file mode 100644 index 0000000000..cde3f4ed2f --- /dev/null +++ b/test/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-ary.js @@ -0,0 +1,16 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Invalid destructuring assignment pattern (array literal) +info: > + It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral + or an ArrayLiteral and if the lexical token sequence matched by + LeftHandSideExpression cannot be parsed with no tokens left over using + AssignmentPattern as the goal symbol. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for ([(x, y)] of []) {} diff --git a/test/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-obj.js b/test/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-obj.js new file mode 100644 index 0000000000..66562b56b4 --- /dev/null +++ b/test/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-obj.js @@ -0,0 +1,16 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Invalid destructuring assignment pattern (object literal) +info: > + It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral + or an ArrayLiteral and if the lexical token sequence matched by + LeftHandSideExpression cannot be parsed with no tokens left over using + AssignmentPattern as the goal symbol. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for ({ m() {} } of []) {} diff --git a/test/language/statements/for-of/head-lhs-member.js b/test/language/statements/for-of/head-lhs-member.js new file mode 100644 index 0000000000..fd8b5b1013 --- /dev/null +++ b/test/language/statements/for-of/head-lhs-member.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Head's AssignmentExpression may be a MemberExpression +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +var iterCount = 0; +var x = {}; + +for (x.y of [23]) { + assert.sameValue(x.y, 23); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-of/head-lhs-non-asnmt-trgt.js b/test/language/statements/for-of/head-lhs-non-asnmt-trgt.js new file mode 100644 index 0000000000..3b0868017b --- /dev/null +++ b/test/language/statements/for-of/head-lhs-non-asnmt-trgt.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Head's LeftHandSideExpression must be a simple assignment target +info: > + It is a Syntax Error if IsValidSimpleAssignmentTarget of + LeftHandSideExpression is false. +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (this of []) {} diff --git a/test/language/statements/for-of/head-var-bound-names-dup.js b/test/language/statements/for-of/head-var-bound-names-dup.js new file mode 100644 index 0000000000..5585534472 --- /dev/null +++ b/test/language/statements/for-of/head-var-bound-names-dup.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: The head's declaration may contain duplicate entries +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +var iterCount = 0; + +for (var [x, x] of [[1, 2]]) { + assert.sameValue(x, 2); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-of/head-var-bound-names-in-stmt.js b/test/language/statements/for-of/head-var-bound-names-in-stmt.js new file mode 100644 index 0000000000..22f76ae282 --- /dev/null +++ b/test/language/statements/for-of/head-var-bound-names-in-stmt.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The body may re-declare variables declared in the head +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +---*/ + +var iterCount = 0; + +for (var x of [99]) { + var x; + + assert.sameValue(x, 99); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-of/head-var-bound-names-let.js b/test/language/statements/for-of/head-var-bound-names-let.js new file mode 100644 index 0000000000..3af7700e34 --- /dev/null +++ b/test/language/statements/for-of/head-var-bound-names-let.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: The head's bound names may include "let" +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +es6id: 13.7.5 +flags: [noStrict] +---*/ + +var iterCount = 0; + +for (var let of [23]) { + assert.sameValue(let, 23); + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for-of/labeled-fn-stmt-const.js b/test/language/statements/for-of/labeled-fn-stmt-const.js new file mode 100644 index 0000000000..09cd108e53 --- /dev/null +++ b/test/language/statements/for-of/labeled-fn-stmt-const.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (const x of []) label1: label2: function f() {} diff --git a/test/language/statements/for-of/labeled-fn-stmt-let.js b/test/language/statements/for-of/labeled-fn-stmt-let.js new file mode 100644 index 0000000000..a4032965e0 --- /dev/null +++ b/test/language/statements/for-of/labeled-fn-stmt-let.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (let x of []) label1: label2: function f() {} diff --git a/test/language/statements/for-of/labeled-fn-stmt-lhs.js b/test/language/statements/for-of/labeled-fn-stmt-lhs.js new file mode 100644 index 0000000000..7873b6bd19 --- /dev/null +++ b/test/language/statements/for-of/labeled-fn-stmt-lhs.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (x of []) label1: label2: function f() {} diff --git a/test/language/statements/for-of/labeled-fn-stmt-var.js b/test/language/statements/for-of/labeled-fn-stmt-var.js new file mode 100644 index 0000000000..11c13cfb7e --- /dev/null +++ b/test/language/statements/for-of/labeled-fn-stmt-var.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (var x of []) label1: label2: function f() {} diff --git a/test/language/statements/for/head-const-bound-names-in-stmt.js b/test/language/statements/for/head-const-bound-names-in-stmt.js new file mode 100644 index 0000000000..65ad8dde24 --- /dev/null +++ b/test/language/statements/for/head-const-bound-names-in-stmt.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The body may not re-declare variables declared in the head +info: | + IterationStatement : + for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement + + It is a Syntax Error if any element of the BoundNames of LexicalDeclaration + also occurs in the VarDeclaredNames of Statement. +negative: SyntaxError +esid: sec-for-statement +es6id: 13.7.4 +---*/ + +for (const x; false; ) { + var x; +} diff --git a/test/language/statements/for/head-let-bound-names-in-stmt.js b/test/language/statements/for/head-let-bound-names-in-stmt.js new file mode 100644 index 0000000000..e026d4edf8 --- /dev/null +++ b/test/language/statements/for/head-let-bound-names-in-stmt.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The body may not re-declare variables declared in the head +info: | + IterationStatement : + for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement + + It is a Syntax Error if any element of the BoundNames of LexicalDeclaration + also occurs in the VarDeclaredNames of Statement. +negative: SyntaxError +esid: sec-for-statement +es6id: 13.7.4 +---*/ + +for (let x; false; ) { + var x; +} diff --git a/test/language/statements/for/head-var-bound-names-in-stmt.js b/test/language/statements/for/head-var-bound-names-in-stmt.js new file mode 100644 index 0000000000..9565ee3db0 --- /dev/null +++ b/test/language/statements/for/head-var-bound-names-in-stmt.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The body may re-declare variables declared in the head +esid: sec-for-statement +es6id: 13.7.4 +---*/ + +var iterCount = 0; +var first = true; + +for (var x; first; first = false) { + var x; + iterCount += 1; +} + +assert.sameValue(iterCount, 1); diff --git a/test/language/statements/for/labeled-fn-stmt-const.js b/test/language/statements/for/labeled-fn-stmt-const.js new file mode 100644 index 0000000000..ec6bfccffa --- /dev/null +++ b/test/language/statements/for/labeled-fn-stmt-const.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (const x; false; ) label1: label2: function f() {} diff --git a/test/language/statements/for/labeled-fn-stmt-expr.js b/test/language/statements/for/labeled-fn-stmt-expr.js new file mode 100644 index 0000000000..80cd61dcd1 --- /dev/null +++ b/test/language/statements/for/labeled-fn-stmt-expr.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for ( ; false; ) label1: label2: function f() {} diff --git a/test/language/statements/for/labeled-fn-stmt-let.js b/test/language/statements/for/labeled-fn-stmt-let.js new file mode 100644 index 0000000000..9ac16eaf56 --- /dev/null +++ b/test/language/statements/for/labeled-fn-stmt-let.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (let x; false; ) label1: label2: function f() {} diff --git a/test/language/statements/for/labeled-fn-stmt-var.js b/test/language/statements/for/labeled-fn-stmt-var.js new file mode 100644 index 0000000000..58c08f623a --- /dev/null +++ b/test/language/statements/for/labeled-fn-stmt-var.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +for (var x; false; ) label1: label2: function f() {} diff --git a/test/language/statements/while/labeled-fn-stmt.js b/test/language/statements/while/labeled-fn-stmt.js new file mode 100644 index 0000000000..e82e931874 --- /dev/null +++ b/test/language/statements/while/labeled-fn-stmt.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: It is a Syntax Error if IsLabelledFunction(Statement) is true. +negative: SyntaxError +esid: sec-semantics-static-semantics-early-errors +es6id: 13.7.1.1 +info: > + Although Annex B describes an extension which permits labelled function + declarations outside of strict mode, this early error is applied regardless + of the language mode. +---*/ + +while (false) label1: label2: function f() {}