mirror of https://github.com/tc39/test262.git
Generate tests
This commit is contained in:
parent
c24a206511
commit
88879de735
|
@ -0,0 +1,32 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-assignment.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var v2, vNull, vHole, vUndefined, vOob;
|
||||
|
||||
var result;
|
||||
var vals = [2, null, , undefined];
|
||||
|
||||
result = [v2 = 10, vNull = 11, vHole = 12, vUndefined = 13, vOob = 14] = vals;
|
||||
|
||||
assert.sameValue(v2, 2);
|
||||
assert.sameValue(vNull, null);
|
||||
assert.sameValue(vHole, 12);
|
||||
assert.sameValue(vUndefined, 13);
|
||||
assert.sameValue(vOob, 14);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,30 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-evaluation.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: The Initializer should only be evaluated if v is undefined. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var flag1 = false, flag2 = false;
|
||||
var _;
|
||||
|
||||
var result;
|
||||
var vals = [14];
|
||||
|
||||
result = [ _ = flag1 = true, _ = flag2 = true ] = vals;
|
||||
|
||||
assert.sameValue(flag1, false);
|
||||
assert.sameValue(flag2, true);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,42 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-fn-name-arrow.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (ArrowFunction) (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
[...] 7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
|
||||
---*/
|
||||
var arrow;
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ arrow = () => {} ] = vals;
|
||||
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
verifyNotEnumerable(arrow, 'name');
|
||||
verifyNotWritable(arrow, 'name');
|
||||
verifyConfigurable(arrow, 'name');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,44 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-fn-name-class.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (ClassExpression) (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [class, destructuring-binding]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
[...] 7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
|
||||
---*/
|
||||
var xCls, cls;
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ xCls = class x {},cls = class {} ] = vals;
|
||||
|
||||
assert(xCls.name !== 'xCls');
|
||||
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
verifyNotEnumerable(cls, 'name');
|
||||
verifyNotWritable(cls, 'name');
|
||||
verifyConfigurable(cls, 'name');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,44 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-fn-name-cover.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (CoverParenthesizedExpression) (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
[...] 7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
|
||||
---*/
|
||||
var xCover, cover;
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ xCover = (0, function() {}), cover = (function() {}) ] = vals;
|
||||
|
||||
assert(xCover.name !== 'xCover');
|
||||
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
verifyNotEnumerable(cover, 'name');
|
||||
verifyNotWritable(cover, 'name');
|
||||
verifyConfigurable(cover, 'name');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,44 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-fn-name-fn.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (FunctionExpression) (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [class, destructuring-binding]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
[...] 7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
|
||||
---*/
|
||||
var xFn, fn;
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ xFn = function x() {}, fn = function() {} ] = vals;
|
||||
|
||||
assert(xFn.name !== 'xFn');
|
||||
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
verifyNotEnumerable(fn, 'name');
|
||||
verifyNotWritable(fn, 'name');
|
||||
verifyConfigurable(fn, 'name');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,44 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-fn-name-gen.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (GeneratorExpression) (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
[...] 7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
|
||||
---*/
|
||||
var xGen, gen;
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ xGen = function* x() {}, gen = function*() {} ] = vals;
|
||||
|
||||
assert.notSameValue(xGen.name, 'xGen');
|
||||
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
verifyNotEnumerable(gen, 'name');
|
||||
verifyNotWritable(gen, 'name');
|
||||
verifyConfigurable(gen, 'name');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,28 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-in.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: The Initializer in an AssignmentElement may be an `in` expression. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x;
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ x = 'x' in {} ] = vals;
|
||||
|
||||
assert.sameValue(x, false);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,25 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-let.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Value retrieval of Initializer obeys `let` semantics. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [let, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x;
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
0, [ x = y ] = [];
|
||||
});
|
||||
|
||||
let y;
|
|
@ -0,0 +1,31 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-order.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Initializer values should be assigned in left-to-right order. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x = 0;
|
||||
var a, b;
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ a = x += 1, b = x *= 2 ] = vals;
|
||||
|
||||
assert.sameValue(a, 1);
|
||||
assert.sameValue(b, 2);
|
||||
assert.sameValue(x, 2);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,29 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-simple-no-strict.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var argument, eval;
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [arguments = 4, eval = 5] = vals;
|
||||
|
||||
assert.sameValue(arguments, 4);
|
||||
assert.sameValue(eval, 5);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,21 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-simple-strict.case
|
||||
// - src/dstr-assignment/syntax/assignment-expr.template
|
||||
/*---
|
||||
description: It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is false. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, onlyStrict]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
0, [arguments] = ;
|
|
@ -0,0 +1,44 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-yield-expr.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the Initializer of an AssignmentElement within a generator function body, it behaves as a YieldExpression. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var value = [];
|
||||
var iterationResult, iter, x;
|
||||
iter = (function*() {
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ x = yield ] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
})();
|
||||
|
||||
iterationResult = iter.next();
|
||||
|
||||
assert.sameValue(iterationResult.value, undefined);
|
||||
assert.sameValue(iterationResult.done, false);
|
||||
assert.sameValue(x, undefined);
|
||||
|
||||
iterationResult = iter.next(86);
|
||||
|
||||
assert.sameValue(iterationResult.value, undefined);
|
||||
assert.sameValue(iterationResult.done, true);
|
||||
assert.sameValue(x, 86);
|
|
@ -0,0 +1,21 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-yield-ident-invalid.case
|
||||
// - src/dstr-assignment/syntax/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, onlyStrict]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
0, [ x = yield ] = [];
|
|
@ -0,0 +1,29 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-init-yield-ident-valid.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var yield = 4;
|
||||
var x;
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ x = yield ] = vals;
|
||||
|
||||
assert.sameValue(x, 4);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,33 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-get-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned from GetIterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
var _;
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ _ ] = iterable;
|
||||
});
|
|
@ -0,0 +1,50 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-nrml-close-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned from IteratorClose (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, result).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var _;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ _ ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-nrml-close-null.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
6. Return result.
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
|
||||
exception.
|
||||
|
||||
---*/
|
||||
var _;
|
||||
var iterable = {};
|
||||
var nextCount = 0;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [ _ ] = iterable;
|
||||
});
|
|
@ -0,0 +1,52 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-nrml-close-skip.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is not called when assignment evaluation has exhausted the iterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, result).
|
||||
6. Return result.
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var _;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ _ ] = vals;
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 0);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,68 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-nrml-close.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when assignment evaluation has not exhausted the iterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
6. Return result.
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var _;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ _ ] = vals;
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,67 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-rtrn-close-err.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when reference evaluation produces a "return" completion (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
6. Return result.
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
|
||||
---*/
|
||||
var returnCount = 0;
|
||||
var unreachable = 0;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
var iter;
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
function* g() {
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ {}[ yield ] ] = vals;
|
||||
|
||||
unreachable += 1;
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}
|
||||
iter = g();
|
||||
iter.next();
|
||||
assert.throws(Test262Error, function() {
|
||||
iter.return();
|
||||
});
|
||||
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-rtrn-close-null.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
6. Return result.
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
|
||||
exception.
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
return: function() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
var iter;
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
function* g() {
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ {}[yield] ] = vals;
|
||||
|
||||
unreachable += 1;
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}
|
||||
|
||||
iter = g();
|
||||
iter.next();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter.return();
|
||||
});
|
|
@ -0,0 +1,74 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-rtrn-close.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when reference evaluation produces a "return" completion (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
6. Return result.
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
|
||||
---*/
|
||||
var returnCount = 0;
|
||||
var unreachable = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
var iter, result;
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
function* g() {
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ {}[yield] ] = vals;
|
||||
|
||||
unreachable += 1;
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}
|
||||
iter = g();
|
||||
iter.next();
|
||||
result = iter.return(777);
|
||||
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
|
||||
assert.sameValue(result.value, 777);
|
||||
assert(result.done, 'Iterator correctly closed');
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
|
@ -0,0 +1,55 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-thrw-close-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when reference evaluation produces a "throw" completion (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
6. Return result.
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
function ReturnError() {}
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
|
||||
// This value should be discarded.
|
||||
throw new ReturnError();
|
||||
}
|
||||
};
|
||||
var thrower = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ {}[thrower()] ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 0);
|
||||
assert.sameValue(returnCount, 1);
|
|
@ -0,0 +1,49 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-thrw-close-skip.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is not called when iteration produces an abrupt completion (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
6. Return result.
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
throw new Test262Error();
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
var _;
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ x ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 0);
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-iter-thrw-close.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when reference evaluation produces a "throw" completion (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
6. Return result.
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
}
|
||||
};
|
||||
var thrower = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ {}[thrower()] ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 0);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
|
@ -0,0 +1,21 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-array-invalid.case
|
||||
// - src/dstr-assignment/syntax/assignment-expr.template
|
||||
/*---
|
||||
description: 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. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
0, [[(x, y)]] = [[]];
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-array-null.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an array literal and the value is `null`, a TypeError should be thrown. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var _;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [[ _ ]] = [null];
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-array-undefined-hole.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an array literal and the value is a "hole", a TypeError should be thrown. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var _;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [[ _ ]] = [ , ];
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-array-undefined-own.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an array literal and the value is `undefined`, a TypeError should be thrown. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var _;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [[ x ]] = [undefined];
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-array-undefined.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an array literal and no value is defined, a TypeError should be thrown. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var _;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [[ x ]] = [];
|
||||
});
|
|
@ -0,0 +1,46 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-array-yield-expr.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and within a generator function body, it behaves as a YieldExpression. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var value = [[22]];
|
||||
var x = {};
|
||||
var iterationResult, iter;
|
||||
|
||||
iter = (function*() {
|
||||
|
||||
var result;
|
||||
var vals = value;
|
||||
|
||||
result = [[x[yield]]] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}());
|
||||
|
||||
iterationResult = iter.next();
|
||||
|
||||
assert.sameValue(iterationResult.value, undefined);
|
||||
assert.sameValue(iterationResult.done, false);
|
||||
assert.sameValue(x.prop, undefined);
|
||||
|
||||
iterationResult = iter.next('prop');
|
||||
|
||||
assert.sameValue(iterationResult.value, undefined);
|
||||
assert.sameValue(iterationResult.done, true);
|
||||
assert.sameValue(x.prop, 22);
|
|
@ -0,0 +1,21 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-array-yield-ident-invalid.case
|
||||
// - src/dstr-assignment/syntax/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, onlyStrict]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
0, [[x[yield]]] = [[]];
|
|
@ -0,0 +1,29 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-array-yield-ident-valid.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var yield = 'prop';
|
||||
var x = {};
|
||||
|
||||
var result;
|
||||
var vals = [[22]];
|
||||
|
||||
result = [[x[yield]]] = vals;
|
||||
|
||||
assert.sameValue(x.prop, 22);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,28 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-array.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x;
|
||||
|
||||
var result;
|
||||
var vals = [[1]];
|
||||
|
||||
result = [[x]] = vals;
|
||||
|
||||
assert.sameValue(x, 1);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,21 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-obj-invalid.case
|
||||
// - src/dstr-assignment/syntax/assignment-expr.template
|
||||
/*---
|
||||
description: 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. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
0, [{ get x() {} }] = [{}];
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-obj-null.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an object literal and the value is `null`, a TypeError should be thrown. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [{ x }] = [null];
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-obj-undefined-hole.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an object literal and the value is a "hole", a TypeError should be thrown. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [{ x }] = [ , ];
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-obj-undefined-own.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an object literal and the value is `undefined`, a TypeError should be thrown. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [{ x }] = [undefined];
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-obj-undefined.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an object literal and no value is defined, a TypeError should be thrown. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [{ x }] = [];
|
||||
});
|
|
@ -0,0 +1,44 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-obj-yield-expr.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it behaves as a YieldExpression. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var iterationResult, iter, x;
|
||||
|
||||
iter = (function*() {
|
||||
|
||||
var result;
|
||||
var vals = [{}];
|
||||
|
||||
result = [{ x = yield }] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}());
|
||||
|
||||
iterationResult = iter.next();
|
||||
|
||||
assert.sameValue(iterationResult.value, undefined);
|
||||
assert.sameValue(iterationResult.done, false);
|
||||
assert.sameValue(x, undefined);
|
||||
|
||||
iterationResult = iter.next(4);
|
||||
|
||||
assert.sameValue(iterationResult.value, undefined);
|
||||
assert.sameValue(iterationResult.done, true);
|
||||
assert.sameValue(x, 4);
|
|
@ -0,0 +1,21 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-obj-yield-ident-invalid.case
|
||||
// - src/dstr-assignment/syntax/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the Initializer of a nested destructuring assignment outside of a generator function body, it behaves as a IdentifierReference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, onlyStrict]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
0, [{ x = yield }] = [{}];
|
|
@ -0,0 +1,29 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-obj-yield-ident-valid.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the Initializer of a nested destructuring assignment outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var yield = 2;
|
||||
var x;
|
||||
|
||||
var result;
|
||||
var vals = [{}];
|
||||
|
||||
result = [{ x = yield }] = vals;
|
||||
|
||||
assert.sameValue(x, 2);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,28 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-nested-obj.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x;
|
||||
|
||||
var result;
|
||||
var vals = [{ x: 2 }];
|
||||
|
||||
result = [{ x }] = vals;
|
||||
|
||||
assert.sameValue(x, 2);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-put-const.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: The assignment target should obey `const` semantics. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [const, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
const c = null;
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [ c ] = [1];
|
||||
});
|
|
@ -0,0 +1,24 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-put-let.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: The assignment target should obey `let` semantics. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [let, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
0, [ x ] = [];
|
||||
});
|
||||
|
||||
let x;
|
|
@ -0,0 +1,36 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-put-prop-ref-no-get.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x, setValue;
|
||||
x = {
|
||||
get y() {
|
||||
$ERROR('The property should not be accessed.');
|
||||
},
|
||||
set y(val) {
|
||||
setValue = val;
|
||||
}
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = [23];
|
||||
|
||||
result = [x.y] = vals;
|
||||
|
||||
assert.sameValue(setValue, 23);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,27 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-put-prop-ref-user-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Any error raised as a result of setting the value should be forwarded to the runtime. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x = {
|
||||
set y(val) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [x.y] = [23];
|
||||
});
|
|
@ -0,0 +1,28 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-put-prop-ref.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x = {};
|
||||
|
||||
var result;
|
||||
var vals = [4];
|
||||
|
||||
result = [x.y] = vals;
|
||||
|
||||
assert.sameValue(x.y, 4);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,32 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-put-unresolvable-no-strict.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
{
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [ unresolvable ] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}
|
||||
|
||||
assert.sameValue(unresolvable, undefined);
|
|
@ -0,0 +1,22 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-put-unresolvable-strict.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, onlyStrict]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
0, [ unresolvable ] = [];
|
||||
});
|
|
@ -0,0 +1,30 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-target-identifier.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var x, y, z;
|
||||
|
||||
var result;
|
||||
var vals = [1, 2, 3];
|
||||
|
||||
result = [x, y, z] = vals;
|
||||
|
||||
assert.sameValue(x, 1);
|
||||
assert.sameValue(y, 2);
|
||||
assert.sameValue(z, 3);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,29 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-target-simple-no-strict.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var argument, eval;
|
||||
|
||||
var result;
|
||||
var vals = [2, 3];
|
||||
|
||||
result = [arguments, eval] = vals;
|
||||
|
||||
assert.sameValue(arguments, 2);
|
||||
assert.sameValue(eval, 3);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,21 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-target-simple-strict.case
|
||||
// - src/dstr-assignment/syntax/assignment-expr.template
|
||||
/*---
|
||||
description: It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is false. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, onlyStrict]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
0, [arguments] = [];
|
|
@ -0,0 +1,46 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-target-yield-expr.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement within a generator function body, it behaves as a YieldExpression. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var value = [33];
|
||||
var x = {};
|
||||
var iterationResult, iter;
|
||||
|
||||
iter = (function*() {
|
||||
|
||||
var result;
|
||||
var vals = [33];
|
||||
|
||||
result = [ x[yield] ] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}());
|
||||
|
||||
iterationResult = iter.next();
|
||||
|
||||
assert.sameValue(iterationResult.value, undefined);
|
||||
assert.sameValue(iterationResult.done, false);
|
||||
assert.sameValue(x.prop, undefined);
|
||||
|
||||
iterationResult = iter.next('prop');
|
||||
|
||||
assert.sameValue(iterationResult.value, undefined);
|
||||
assert.sameValue(iterationResult.done, true);
|
||||
assert.sameValue(x.prop, 33);
|
|
@ -0,0 +1,21 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-target-yield-invalid.case
|
||||
// - src/dstr-assignment/syntax/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, onlyStrict]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
0, [ x[yield] ] = [];
|
|
@ -0,0 +1,29 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-target-yield-valid.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var yield = 'prop';
|
||||
var x = {};
|
||||
|
||||
var result;
|
||||
var vals = [33];
|
||||
|
||||
result = [ x[yield] ] = vals;
|
||||
|
||||
assert.sameValue(x.prop, 33);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-abpt.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned during evaluation of elision (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
6. If Elision is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with
|
||||
iteratorRecord as the argument.
|
||||
b. If status is an abrupt completion, then
|
||||
i. If iteratorRecord.[[done]] is false, return
|
||||
IteratorClose(iterator, status).
|
||||
ii. Return Completion(status).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
|
||||
if (nextCount === 2) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ x , , ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 2);
|
||||
assert.sameValue(returnCount, 0);
|
|
@ -0,0 +1,59 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned from IteratorClose (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
6. If Elision is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with
|
||||
iteratorRecord as the argument.
|
||||
b. If status is an abrupt completion, then
|
||||
[...]
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ x , , ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 2);
|
||||
assert.sameValue(returnCount, 1);
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close-null.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
6. If Elision is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with
|
||||
iteratorRecord as the argument.
|
||||
b. If status is an abrupt completion, then
|
||||
[...]
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
|
||||
exception.
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
var x;
|
||||
var nextCount = 0;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [ x , , ] = iterable;
|
||||
});
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close-skip.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose not invoked when elision exhausts the iterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
6. If Elision is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with
|
||||
iteratorRecord as the argument.
|
||||
b. If status is an abrupt completion, then
|
||||
[...]
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
9. Return Completion(status).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
|
||||
return { done: nextCount > 1 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ x , , ] = vals;
|
||||
|
||||
assert.sameValue(nextCount, 2);
|
||||
assert.sameValue(returnCount, 0);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,75 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose invoked when elision does not exhaust the iterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
6. If Elision is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with
|
||||
iteratorRecord as the argument.
|
||||
b. If status is an abrupt completion, then
|
||||
[...]
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ x , , ] = vals;
|
||||
|
||||
assert.sameValue(nextCount, 2);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,34 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-get-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned from GetIterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
var x;
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ x , ] = iterable;
|
||||
});
|
|
@ -0,0 +1,59 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned from IteratorClose (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
b. Return Completion(status).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var thrower = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ x , ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-null.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
b. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
|
||||
exception.
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
var x;
|
||||
var nextCount = 0;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [ x , ] = iterable;
|
||||
});
|
|
@ -0,0 +1,61 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-skip.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is not invoked when evaluation of AssignmentElementList exhausts the iterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
b. Return Completion(status).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var thrower = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ x , ] = vals;
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 0);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,74 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is invoked when evaluation of AssignmentElementList completes without exhausting the iterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
b. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ x , ] = vals;
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,74 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-rtrn-close-err.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "return" completion and the iterator has not been marked as "done" (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
|
||||
---*/
|
||||
var returnCount = 0;
|
||||
var unreachable = 0;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
var iter;
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
function* g() {
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ {}[yield] , ] = vals;
|
||||
|
||||
unreachable += 1;
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}
|
||||
|
||||
iter = g();
|
||||
iter.next();
|
||||
assert.throws(Test262Error, function() {
|
||||
iter.return();
|
||||
});
|
||||
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-rtrn-close-null.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
b. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
|
||||
exception.
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
return: function() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
var iter;
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
function* g() {
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ {}[yield] , ] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}
|
||||
|
||||
iter = g();
|
||||
iter.next();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter.return();
|
||||
});
|
|
@ -0,0 +1,82 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-rtrn-close.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "return" completion and the iterator has not been marked as "done" (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
b. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
|
||||
---*/
|
||||
var returnCount = 0;
|
||||
var unreachable = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
var iter, result;
|
||||
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
function* g() {
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ {}[yield] , ] = vals;
|
||||
|
||||
unreachable += 1;
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
};
|
||||
|
||||
iter = g();
|
||||
iter.next();
|
||||
result = iter.return(888);
|
||||
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
|
||||
assert.sameValue(result.value, 888);
|
||||
assert(result.done, 'Iterator correctly closed');
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
|
@ -0,0 +1,67 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-thrw-close-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "throw" completion and the iterator has not been marked as "done" (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var thrower = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
function ReturnError() {}
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
|
||||
// This value should be discarded.
|
||||
throw new ReturnError();
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ {}[thrower()] , ] = iterable;
|
||||
});
|
||||
|
||||
|
||||
assert.sameValue(nextCount, 0);
|
||||
assert.sameValue(returnCount, 1);
|
|
@ -0,0 +1,58 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-thrw-close-skip.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is not invoked when evaluation of AssignmentElementList returns an abrupt completion and the iterator has been marked as "done" (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
b. Return Completion(status).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var thrower = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
throw new Test262Error();
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
var x;
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ x , ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 0);
|
|
@ -0,0 +1,70 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-list-thrw-close.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "throw" completion and the iterator has not been marked as "done" (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
|
||||
4. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
|
||||
iteratorRecord as the argument.
|
||||
5. If status is an abrupt completion, then
|
||||
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
b. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var thrower = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ {}[thrower()] , ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 0);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
|
@ -0,0 +1,61 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-rest-nrml-close-skip.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is not called when rest element evaluation has exhausted the iterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
7. If AssignmentRestElement is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
|
||||
with iteratorRecord as the argument.
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
9. Return Completion(status).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var x, y;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { value: nextCount, done: nextCount > 1 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ x , ...y ] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
assert.sameValue(nextCount, 2, 'nextCount');
|
||||
assert.sameValue(returnCount, 0, 'returnCount');
|
||||
assert.sameValue(x, 1, 'x');
|
||||
assert.sameValue(y.length, 0, 'y.length');
|
|
@ -0,0 +1,83 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-rest-rtrn-close-err.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when AssignmentRestEvaluation produces a "return" completion due to reference evaluation (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
7. If AssignmentRestElement is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
|
||||
with iteratorRecord as the argument.
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
9. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var unreachable = 0;
|
||||
var x;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
var iter;
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
function* g() {
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ x , ...{}[yield] ] = vals;
|
||||
|
||||
unreachable += 1;
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}
|
||||
|
||||
iter = g();
|
||||
iter.next();
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
iter.return();
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-rest-rtrn-close-null.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
7. If AssignmentRestElement is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
|
||||
with iteratorRecord as the argument.
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
9. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var iterable = {};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
var iter;
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
function* g() {
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ x , ...{}[yield] ] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}
|
||||
|
||||
iter = g();
|
||||
iter.next();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
iter.return();
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
|
@ -0,0 +1,89 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-rest-rtrn-close.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when AssignmentRestEvaluation produces a "return" completion due to reference evaluation (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, generators, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
7. If AssignmentRestElement is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
|
||||
with iteratorRecord as the argument.
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
9. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var unreachable = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
var iter, result;
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
function* g() {
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ x , ...{}[yield] ] = vals;
|
||||
|
||||
unreachable += 1;
|
||||
|
||||
assert.sameValue(result, vals);
|
||||
|
||||
}
|
||||
|
||||
iter = g();
|
||||
iter.next();
|
||||
result = iter.return(999);
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
|
||||
assert.sameValue(result.value, 999);
|
||||
assert(result.done, 'Iterator correctly closed');
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
|
@ -0,0 +1,68 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-rest-thrw-close-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when AssignmentRestEvaluation produces a "throw" completion due to reference evaluation (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
7. If AssignmentRestElement is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
|
||||
with iteratorRecord as the argument.
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
9. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
7. If completion.[[type]] is throw, return Completion(completion)
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var x;
|
||||
function ReturnError() {}
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
|
||||
// This value should be discarded.
|
||||
throw new ReturnError();
|
||||
}
|
||||
};
|
||||
var thrower = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ x , ...{}[thrower()] ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
|
@ -0,0 +1,61 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-rest-thrw-close-skip.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned during iteration for rest element (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
7. If AssignmentRestElement is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
|
||||
with iteratorRecord as the argument.
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
9. Return Completion(status).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
|
||||
if (nextCount === 2) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ x , ...x ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 2);
|
||||
assert.sameValue(returnCount, 0);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elem-trlg-iter-rest-thrw-close.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when AssignmentRestEvaluation produces a "throw" completion due to reference evaluation (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern :
|
||||
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
|
||||
|
||||
[...]
|
||||
7. If AssignmentRestElement is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
|
||||
with iteratorRecord as the argument.
|
||||
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
status).
|
||||
9. Return Completion(status).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var x;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
}
|
||||
};
|
||||
var thrower = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ x , ...{}[thrower()] ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
|
@ -0,0 +1,49 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-iter-abpt.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is not called when iteration produces an abrupt completion (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ Elision ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
throw new Test262Error();
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ , ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 0);
|
|
@ -0,0 +1,32 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-iter-get-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned from GetIterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ Elision ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ , ] = iterable;
|
||||
});
|
|
@ -0,0 +1,52 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-iter-nrml-close-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned from IteratorClose (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ Elision ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
6. Return result.
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [ , ] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-iter-nrml-close-null.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ Elision ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
[...]
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
|
||||
exception.
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
var nextCount = 0;
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [ , ] = iterable;
|
||||
});
|
|
@ -0,0 +1,53 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-iter-nrml-close-skip.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is not called when iteration has exhausted the iterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ Elision ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ , ] = vals;
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 0);
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,68 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-iter-nrml-close.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose is called when assignment evaluation has not exhausted the iterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ Elision ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
|
||||
result).
|
||||
[...]
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
// Set an upper-bound to limit unnecessary iteration in non-conformant
|
||||
// implementations
|
||||
return { done: nextCount > 10 };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [ , ] = vals;
|
||||
|
||||
assert.sameValue(nextCount, 1);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,27 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-val-array.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern containing only Elisions requires iterable values (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [,] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,22 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-val-bool.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for boolean values. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [,] = true;
|
||||
});
|
|
@ -0,0 +1,22 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-val-null.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for `null`. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [,] = null;
|
||||
});
|
|
@ -0,0 +1,22 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-val-num.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for number values. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [,] = 1;
|
||||
});
|
|
@ -0,0 +1,27 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-val-string.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern containing only Elisions requires iterable values (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
var result;
|
||||
var vals = 'string literal';
|
||||
|
||||
result = [,] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,23 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-val-symbol.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for symbol values. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
var s = Symbol();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [,] = s;
|
||||
});
|
|
@ -0,0 +1,22 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-elision-val-undef.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for `undefined`. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [,] = undefined;
|
||||
});
|
|
@ -0,0 +1,48 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-empty-iter-close-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned from IteratorClose (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
3. Return IteratorClose(iterator, NormalCompletion(empty)).
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [] = iterable;
|
||||
});
|
||||
|
||||
assert.sameValue(nextCount, 0);
|
||||
assert.sameValue(returnCount, 1);
|
|
@ -0,0 +1,50 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-empty-iter-close-null.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
3. Return IteratorClose(iterator, NormalCompletion(empty)).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
7. If completion.[[type]] is throw, return Completion(completion).
|
||||
8. If innerResult.[[type]] is throw, return Completion(innerResult).
|
||||
9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
|
||||
exception.
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [] = iterable;
|
||||
});
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-empty-iter-close.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: Iterator is closed without iterating (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
3. Return IteratorClose(iterator, NormalCompletion(empty)).
|
||||
|
||||
7.4.6 IteratorClose( iterator, completion )
|
||||
|
||||
[...]
|
||||
6. Let innerResult be Call(return, iterator, « »).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var nextCount = 0;
|
||||
var returnCount = 0;
|
||||
var thisValue = null;
|
||||
var args = null;
|
||||
var iterable = {};
|
||||
var iterator = {
|
||||
next: function() {
|
||||
nextCount += 1;
|
||||
return { done: true };
|
||||
},
|
||||
return: function() {
|
||||
returnCount += 1;
|
||||
thisValue = this;
|
||||
args = arguments;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
return iterator;
|
||||
};
|
||||
|
||||
var result;
|
||||
var vals = iterable;
|
||||
|
||||
result = [] = vals;
|
||||
|
||||
assert.sameValue(nextCount, 0);
|
||||
assert.sameValue(returnCount, 1);
|
||||
assert.sameValue(thisValue, iterator, 'correct `this` value');
|
||||
assert(!!args, 'arguments object provided');
|
||||
assert.sameValue(args.length, 0, 'zero arguments specified');
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,32 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-empty-iter-get-err.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: Abrupt completion returned from GetIterator (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [Symbol.iterator, destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
|
||||
ArrayAssignmentPattern : [ ]
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
|
||||
---*/
|
||||
var iterable = {};
|
||||
iterable[Symbol.iterator] = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
0, [] = iterable;
|
||||
});
|
|
@ -0,0 +1,27 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-empty-val-array.case
|
||||
// - src/dstr-assignment/default/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
var result;
|
||||
var vals = [];
|
||||
|
||||
result = [] = vals;
|
||||
|
||||
|
||||
|
||||
assert.sameValue(result, vals);
|
|
@ -0,0 +1,22 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-empty-val-bool.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for boolean values (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [] = true;
|
||||
});
|
|
@ -0,0 +1,22 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-assignment/array-empty-val-null.case
|
||||
// - src/dstr-assignment/error/assignment-expr.template
|
||||
/*---
|
||||
description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for `null`. (AssignmentExpression)
|
||||
esid: sec-variable-statement-runtime-semantics-evaluation
|
||||
es6id: 13.3.2.4
|
||||
features: [destructuring-binding]
|
||||
flags: [generated]
|
||||
info: |
|
||||
VariableDeclaration : BindingPattern Initializer
|
||||
|
||||
1. Let rhs be the result of evaluating Initializer.
|
||||
2. Let rval be GetValue(rhs).
|
||||
3. ReturnIfAbrupt(rval).
|
||||
4. Return the result of performing BindingInitialization for
|
||||
BindingPattern passing rval and undefined as arguments.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
0, [] = null;
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue