Skip to content
Snippets Groups Projects
Commit 4dd2d9b7 authored by Mike Pennisi's avatar Mike Pennisi Committed by Gorkem Yakin
Browse files

Add tests for IterationStatement early errors

parent 62857dcb
No related branches found
No related tags found
No related merge requests found
Showing
with 309 additions and 0 deletions
// 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)
// 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 {}) {}
// 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;
}
// 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 {}) {}
// 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 {}) {}
// 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;
}
// 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 {}) {}
// 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 {}) {}
// 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);
// 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 {}) {}
// 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 {}) {}
// 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);
// 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 {}) {}
// 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);
// 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);
// 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);
// 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() {}
// 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() {}
// 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() {}
// 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() {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment