mirror of https://github.com/tc39/test262.git
Add tests for assignment target validation of new ES2015 forms (#693)
This re-factors some existing Sputnik tests to be more targeted and to use a pattern that can be generalized to other forms. We could test these all day, but I've limited myself to forms introduced in ES2015, specifically YieldExpression and new.target. Note that SpiderMonkey incorrectly throws a SyntaxError for these. I thoughtlessly wrote ReferenceError tests for yield = 1 until I realized that such productions are not actually recognized by the grammar, so the early errors do not apply. Instead, I've added a negative syntax test for that case. * Refactor test for valid cover * Add tests for ValidSimpleAssignmentTarget Ensure that constructs introduced in ES2015 are disallowed as assignment targets, with or without a "cover" grammar. * Add test for grammar precedence of YieldExpression
This commit is contained in:
parent
f554f68ae9
commit
ab4ff914fb
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-assignment-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.14.1
|
||||||
|
es5id: 11.1.6_A3_T5
|
||||||
|
description: Applied to a "covered" IdentifierReference
|
||||||
|
info: |
|
||||||
|
AssignmentExpression : LeftHandSideExpression = AssignmentExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if LeftHandSideExpression is neither an
|
||||||
|
ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If this IdentifierReference is contained in strict mode code and
|
||||||
|
StringValue of Identifier is "eval" or "arguments", return false.
|
||||||
|
2. Return true.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var x;
|
||||||
|
|
||||||
|
(x) = 1;
|
||||||
|
|
||||||
|
assert.sameValue(x, 1);
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-assignment-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.14.1
|
||||||
|
description: Applied to a "covered" new.target
|
||||||
|
info: |
|
||||||
|
AssignmentExpression : LeftHandSideExpression = AssignmentExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if LeftHandSideExpression is neither an
|
||||||
|
ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
(new.target) = 1;
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-assignment-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.14.1
|
||||||
|
description: Applied to a "covered" YieldExpression
|
||||||
|
info: |
|
||||||
|
AssignmentExpression : LeftHandSideExpression = AssignmentExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if LeftHandSideExpression is neither an
|
||||||
|
ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
12.15.3 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
AssignmentExpression:
|
||||||
|
YieldExpression
|
||||||
|
ArrowFunction
|
||||||
|
LeftHandSideExpression = AssignmentExpression
|
||||||
|
LeftHandSideExpression AssignmentOperator AssignmentExpression
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
features: [generators]
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function* g() {
|
||||||
|
(yield) = 1;
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-assignment-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.14.1
|
||||||
|
description: Applied to new.target
|
||||||
|
info: |
|
||||||
|
AssignmentExpression : LeftHandSideExpression = AssignmentExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if LeftHandSideExpression is neither an
|
||||||
|
ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
new.target = 1;
|
||||||
|
}
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
info: "\"This\" operator only evaluates Expression"
|
|
||||||
es5id: 11.1.6_A3_T5
|
|
||||||
description: Using grouping operator in declaration of variables
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//CHECK#1
|
|
||||||
var x;
|
|
||||||
(x) = 1;
|
|
||||||
if (x !== 1) {
|
|
||||||
$ERROR('#1: (x) = 1; x === 1. Actual: ' + (x));
|
|
||||||
}
|
|
||||||
|
|
||||||
//CHECK#2
|
|
||||||
var y = 1; (y)++; ++(y); (y)--; --(y);
|
|
||||||
if (y !== 1) {
|
|
||||||
$ERROR('#2: var y = 1; (y)++; ++(y); (y)--; --(y); y === 1. Actual: ' + (y));
|
|
||||||
}
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-postfix-expressions-static-semantics-early-errors
|
||||||
|
es6id: 12.4.1
|
||||||
|
es5id: 11.1.6_A3_T5
|
||||||
|
description: Applied to a "covered" IdentifierReference
|
||||||
|
info: |
|
||||||
|
PostfixExpression :
|
||||||
|
LeftHandSideExpression ++
|
||||||
|
LeftHandSideExpression --
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If this IdentifierReference is contained in strict mode code and
|
||||||
|
StringValue of Identifier is "eval" or "arguments", return false.
|
||||||
|
2. Return true.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var y = 1;
|
||||||
|
|
||||||
|
(y)--;
|
||||||
|
|
||||||
|
assert.sameValue(y, 0);
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-postfix-expressions-static-semantics-early-errors
|
||||||
|
es6id: 12.4.1
|
||||||
|
description: Applied to a "covered" new.target
|
||||||
|
info: |
|
||||||
|
PostfixExpression :
|
||||||
|
LeftHandSideExpression ++
|
||||||
|
LeftHandSideExpression --
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
(new.target)--;
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-postfix-expressions-static-semantics-early-errors
|
||||||
|
es6id: 12.4.1
|
||||||
|
description: Applied to a "covered" YieldExpression
|
||||||
|
info: |
|
||||||
|
PostfixExpression :
|
||||||
|
LeftHandSideExpression ++
|
||||||
|
LeftHandSideExpression --
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
12.15.3 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
AssignmentExpression:
|
||||||
|
YieldExpression
|
||||||
|
ArrowFunction
|
||||||
|
LeftHandSideExpression = AssignmentExpression
|
||||||
|
LeftHandSideExpression AssignmentOperator AssignmentExpression
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
features: [generators]
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function* g() {
|
||||||
|
(yield)--;
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-postfix-expressions-static-semantics-early-errors
|
||||||
|
es6id: 12.4.1
|
||||||
|
description: Applied to new.target
|
||||||
|
info: |
|
||||||
|
PostfixExpression :
|
||||||
|
LeftHandSideExpression ++
|
||||||
|
LeftHandSideExpression --
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
new.target--;
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-postfix-expressions-static-semantics-early-errors
|
||||||
|
es6id: 12.4.1
|
||||||
|
es5id: 11.1.6_A3_T5
|
||||||
|
description: Applied to a "covered" IdentifierReference
|
||||||
|
info: |
|
||||||
|
PostfixExpression :
|
||||||
|
LeftHandSideExpression ++
|
||||||
|
LeftHandSideExpression --
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If this IdentifierReference is contained in strict mode code and
|
||||||
|
StringValue of Identifier is "eval" or "arguments", return false.
|
||||||
|
2. Return true.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var y = 1;
|
||||||
|
|
||||||
|
(y)++;
|
||||||
|
|
||||||
|
assert.sameValue(y, 2);
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-postfix-expressions-static-semantics-early-errors
|
||||||
|
es6id: 12.4.1
|
||||||
|
description: Applied to a "covered" new.target
|
||||||
|
info: |
|
||||||
|
PostfixExpression :
|
||||||
|
LeftHandSideExpression ++
|
||||||
|
LeftHandSideExpression --
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
(new.target)++;
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-postfix-expressions-static-semantics-early-errors
|
||||||
|
es6id: 12.4.1
|
||||||
|
description: Applied to a "covered" YieldExpression
|
||||||
|
info: |
|
||||||
|
PostfixExpression :
|
||||||
|
LeftHandSideExpression ++
|
||||||
|
LeftHandSideExpression --
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
12.15.3 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
AssignmentExpression:
|
||||||
|
YieldExpression
|
||||||
|
ArrowFunction
|
||||||
|
LeftHandSideExpression = AssignmentExpression
|
||||||
|
LeftHandSideExpression AssignmentOperator AssignmentExpression
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
features: [generators]
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function* g() {
|
||||||
|
(yield)++;
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-postfix-expressions-static-semantics-early-errors
|
||||||
|
es6id: 12.4.1
|
||||||
|
description: Applied to new.target
|
||||||
|
info: |
|
||||||
|
PostfixExpression :
|
||||||
|
LeftHandSideExpression ++
|
||||||
|
LeftHandSideExpression --
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
LeftHandSideExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
new.target++;
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-unary-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.5.1
|
||||||
|
es5id: 11.1.6_A3_T5
|
||||||
|
description: Applied to a "covered" IdentifierReference
|
||||||
|
info: |
|
||||||
|
UnaryExpression :
|
||||||
|
++ UnaryExpression
|
||||||
|
-- UnaryExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
UnaryExpression is false.
|
||||||
|
|
||||||
|
Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If this IdentifierReference is contained in strict mode code and
|
||||||
|
StringValue of Identifier is "eval" or "arguments", return false.
|
||||||
|
2. Return true.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var y = 1;
|
||||||
|
|
||||||
|
--(y);
|
||||||
|
|
||||||
|
assert.sameValue(y, 0);
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-unary-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.5.1
|
||||||
|
description: Applied to a "covered" new.target
|
||||||
|
info: |
|
||||||
|
UnaryExpression :
|
||||||
|
++ UnaryExpression
|
||||||
|
-- UnaryExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
UnaryExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
--(new.target);
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-unary-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.5.1
|
||||||
|
description: Applied to a "covered" YieldExpression
|
||||||
|
info: |
|
||||||
|
UnaryExpression :
|
||||||
|
++ UnaryExpression
|
||||||
|
-- UnaryExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
UnaryExpression is false.
|
||||||
|
|
||||||
|
12.15.3 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
AssignmentExpression:
|
||||||
|
YieldExpression
|
||||||
|
ArrowFunction
|
||||||
|
LeftHandSideExpression = AssignmentExpression
|
||||||
|
LeftHandSideExpression AssignmentOperator AssignmentExpression
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
features: [generators]
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function* g() {
|
||||||
|
--(yield);
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-unary-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.5.1
|
||||||
|
description: Applied to new.target
|
||||||
|
info: |
|
||||||
|
UnaryExpression :
|
||||||
|
++ UnaryExpression
|
||||||
|
-- UnaryExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
UnaryExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
--new.target;
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-unary-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.5.1
|
||||||
|
es5id: 11.1.6_A3_T5
|
||||||
|
description: Applied to a "covered" IdentifierReference
|
||||||
|
info: |
|
||||||
|
UnaryExpression :
|
||||||
|
++ UnaryExpression
|
||||||
|
-- UnaryExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
UnaryExpression is false.
|
||||||
|
|
||||||
|
Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If this IdentifierReference is contained in strict mode code and
|
||||||
|
StringValue of Identifier is "eval" or "arguments", return false.
|
||||||
|
2. Return true.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var y = 1;
|
||||||
|
|
||||||
|
++(y);
|
||||||
|
|
||||||
|
assert.sameValue(y, 2);
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-unary-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.5.1
|
||||||
|
description: Applied to a "covered" new.target
|
||||||
|
info: |
|
||||||
|
UnaryExpression :
|
||||||
|
++ UnaryExpression
|
||||||
|
-- UnaryExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
UnaryExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
++(new.target);
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-unary-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.5.1
|
||||||
|
description: Applied to a "covered" YieldExpression
|
||||||
|
info: |
|
||||||
|
UnaryExpression :
|
||||||
|
++ UnaryExpression
|
||||||
|
-- UnaryExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
UnaryExpression is false.
|
||||||
|
|
||||||
|
12.15.3 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
AssignmentExpression:
|
||||||
|
YieldExpression
|
||||||
|
ArrowFunction
|
||||||
|
LeftHandSideExpression = AssignmentExpression
|
||||||
|
LeftHandSideExpression AssignmentOperator AssignmentExpression
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
features: [generators]
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function* g() {
|
||||||
|
++(yield);
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-unary-operators-static-semantics-early-errors
|
||||||
|
es6id: 12.5.1
|
||||||
|
description: Applied to new.target
|
||||||
|
info: |
|
||||||
|
UnaryExpression :
|
||||||
|
++ UnaryExpression
|
||||||
|
-- UnaryExpression
|
||||||
|
|
||||||
|
- It is an early Reference Error if IsValidSimpleAssignmentTarget of
|
||||||
|
UnaryExpression is false.
|
||||||
|
|
||||||
|
12.3.1.5 Static Semantics: IsValidSimpleAssignmentTarget
|
||||||
|
|
||||||
|
NewTarget:
|
||||||
|
|
||||||
|
new.target
|
||||||
|
|
||||||
|
1. Return false.
|
||||||
|
negative: ReferenceError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
++new.target;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-generator-function-definitions
|
||||||
|
es6id: 14.4
|
||||||
|
description: A YieldExpression is not a valid LeftHandSideExpression
|
||||||
|
info: |
|
||||||
|
AssignmentExpression[In, Yield] :
|
||||||
|
ConditionalExpression[?In, ?Yield]
|
||||||
|
[+Yield]YieldExpression[?In]
|
||||||
|
ArrowFunction[?In, ?Yield]
|
||||||
|
LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield]
|
||||||
|
LeftHandSideExpression[?Yield] AssignmentOperator AssignmentExpression[?In, ?Yield]
|
||||||
|
|
||||||
|
LeftHandSideExpression[Yield] :
|
||||||
|
NewExpression[?Yield]
|
||||||
|
CallExpression[?Yield]
|
||||||
|
features: [generators]
|
||||||
|
negative: SyntaxError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function* g() {
|
||||||
|
yield = 1;
|
||||||
|
}
|
Loading…
Reference in New Issue