mirror of https://github.com/tc39/test262.git
Generate tests
This commit is contained in:
parent
744cb4d2c9
commit
a969e853e7
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-init-iter-close.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Iterator is closed when not exhausted by pattern evaluation (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [Symbol.iterator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ArrayBindingPattern
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator,
|
||||
result).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var doneCallCount = 0;
|
||||
var iter = {};
|
||||
iter[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
return { value: null, done: false };
|
||||
},
|
||||
return: function() {
|
||||
doneCallCount += 1;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([x] = iter) => {
|
||||
assert.sameValue(doneCallCount, 1);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,57 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-init-iter-get-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Abrupt completion returned by GetIterator (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [Symbol.iterator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ArrayBindingPattern
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
|
||||
---*/
|
||||
var iter = {};
|
||||
iter[Symbol.iterator] = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
|
||||
var f = ([x] = iter) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-init-iter-no-close.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Iterator is not closed when exhausted by pattern evaluation (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [Symbol.iterator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ArrayBindingPattern
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator,
|
||||
result).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var doneCallCount = 0;
|
||||
var iter = {};
|
||||
iter[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
return { value: null, done: true };
|
||||
},
|
||||
return: function() {
|
||||
doneCallCount += 1;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([x] = iter) => {
|
||||
assert.sameValue(doneCallCount, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-name-iter-val.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding with normal value iteration (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
d. If next is false, set iteratorRecord.[[done]] to true.
|
||||
e. Else,
|
||||
[...]
|
||||
i. Let v be IteratorValue(next).
|
||||
ii. If v is an abrupt completion, set
|
||||
iteratorRecord.[[done]] to true.
|
||||
iii. ReturnIfAbrupt(v).
|
||||
5. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
[...]
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([x, y, z] = [1, 2, 3]) => {
|
||||
assert.sameValue(x, 1);
|
||||
assert.sameValue(y, 2);
|
||||
assert.sameValue(z, 3);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([[x, y, z] = [4, 5, 6]] = []) => {
|
||||
assert.sameValue(x, 4);
|
||||
assert.sameValue(y, 5);
|
||||
assert.sameValue(z, 6);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is not used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
[...]
|
||||
e. Else,
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) => {
|
||||
assert.sameValue(x, 7);
|
||||
assert.sameValue(y, 8);
|
||||
assert.sameValue(z, 9);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,70 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generators, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
|
||||
---*/
|
||||
var first = 0;
|
||||
var second = 0;
|
||||
function* g() {
|
||||
first += 1;
|
||||
yield;
|
||||
second += 1;
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([[,] = g()] = []) => {
|
||||
assert.sameValue(first, 1);
|
||||
assert.sameValue(second, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,67 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is not used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generators, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
[...]
|
||||
e. Else,
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
|
||||
---*/
|
||||
var callCount = 0;
|
||||
function* g() {
|
||||
callCount += 1;
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([[,] = g()] = [[]]) => {
|
||||
assert.sameValue(callCount, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,65 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
var initCount = 0;
|
||||
var iterCount = 0;
|
||||
var iter = function*() { iterCount += 1; }();
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([[] = function() { initCount += 1; return iter; }()] = []) => {
|
||||
assert.sameValue(initCount, 1);
|
||||
assert.sameValue(iterCount, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is not used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
[...]
|
||||
e. Else,
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
var initCount = 0;
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([[] = function() { initCount += 1; }()] = [[23]]) => {
|
||||
assert.sameValue(initCount, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,67 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
var values = [2, 1, 3];
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([[...x] = values] = []) => {
|
||||
assert(Array.isArray(x));
|
||||
assert.sameValue(x[0], 2);
|
||||
assert.sameValue(x[1], 1);
|
||||
assert.sameValue(x[2], 3);
|
||||
assert.sameValue(x.length, 3);
|
||||
assert.notSameValue(x, values);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,70 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is not used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
[...]
|
||||
e. Else,
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
var values = [2, 1, 3];
|
||||
var initCount = 0;
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([[...x] = function() { initCount += 1; }()] = [values]) => {
|
||||
assert(Array.isArray(x));
|
||||
assert.sameValue(x[0], 2);
|
||||
assert.sameValue(x[1], 1);
|
||||
assert.sameValue(x[2], 3);
|
||||
assert.sameValue(x.length, 3);
|
||||
assert.notSameValue(x, values);
|
||||
assert.sameValue(initCount, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Nested array destructuring with a null value (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPattern Initializeropt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
[...]
|
||||
e. Else
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ArrayBindingPattern
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
---*/
|
||||
|
||||
var f = ([[x]] = [null]) => {};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer with an exhausted iterator (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
[...]
|
||||
7. If environment is undefined, return PutValue(lhs, v).
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([x = 23] = []) => {
|
||||
assert.sameValue(x, 23);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding does assign name to arrow functions (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
[...]
|
||||
7. If environment is undefined, return PutValue(lhs, v).
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([arrow = () => {}] = []) => {
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding assigns `name` to "anonymous" classes (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
[...]
|
||||
7. If environment is undefined, return PutValue(lhs, v).
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([cls = class {}, xCls = class X {}] = []) => {
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
assert.notSameValue(xCls.name, 'xCls');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
[...]
|
||||
7. If environment is undefined, return PutValue(lhs, v).
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([cover = (function () {}), xCover = (0, function() {})] = []) => {
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
assert.notSameValue(xCover.name, 'xCover');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding assigns name to "anonymous" functions (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
[...]
|
||||
7. If environment is undefined, return PutValue(lhs, v).
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([fn = function () {}, xFn = function x() {}] = []) => {
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
assert.notSameValue(xFn.name, 'xFn');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding assigns name to "anonymous" generator functions (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
[...]
|
||||
7. If environment is undefined, return PutValue(lhs, v).
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([gen = function* () {}, xGen = function* x() {}] = []) => {
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
assert.notSameValue(xGen.name, 'xGen');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,58 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer with a "hole" (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
[...] 6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
[...]
|
||||
7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([x = 23] = [,]) => {
|
||||
assert.sameValue(x, 23);
|
||||
// another statement
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,67 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer is not evaluated when value is not `undefined` (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
7. If environment is undefined, return PutValue(lhs, v).
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
var initCount = 0;
|
||||
function counter() {
|
||||
initCount += 1;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) => {
|
||||
assert.sameValue(w, null);
|
||||
assert.sameValue(x, 0);
|
||||
assert.sameValue(y, false);
|
||||
assert.sameValue(z, '');
|
||||
assert.sameValue(initCount, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,55 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer returns an abrupt completion (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
---*/
|
||||
|
||||
var f = ([x = (function() { throw new Test262Error(); })()] = [undefined]) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,61 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer with an undefined value (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
[...]
|
||||
7. If environment is undefined, return PutValue(lhs, v).
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([x = 23] = [undefined]) => {
|
||||
assert.sameValue(x, 23);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer is an unresolvable reference (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
|
||||
6.2.3.1 GetValue (V)
|
||||
|
||||
1. ReturnIfAbrupt(V).
|
||||
2. If Type(V) is not Reference, return V.
|
||||
3. Let base be GetBase(V).
|
||||
4. If IsUnresolvableReference(V), throw a ReferenceError exception.
|
||||
---*/
|
||||
|
||||
var f = ([ x = unresolvableReference ] = []) => {};
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,65 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding when value iteration completes (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
d. If next is false, set iteratorRecord.[[done]] to true.
|
||||
e. Else,
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
[...]
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([x] = []) => {
|
||||
assert.sameValue(x, undefined);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding when value iteration was completed previously (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, then
|
||||
[...]
|
||||
5. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
[...]
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([_, x] = []) => {
|
||||
assert.sameValue(x, undefined);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Error forwarding when IteratorStep returns an abrupt completion (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
---*/
|
||||
var g = {};
|
||||
g[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var f = ([x] = g) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,74 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Error forwarding when IteratorValue returns an abrupt completion (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
d. If next is false, set iteratorRecord.[[done]] to true.
|
||||
e. Else,
|
||||
i. Let v be IteratorValue(next).
|
||||
ii. If v is an abrupt completion, set iteratorRecord.[[done]] to
|
||||
true.
|
||||
iii. ReturnIfAbrupt(v).
|
||||
---*/
|
||||
var poisonedValue = Object.defineProperty({}, 'value', {
|
||||
get: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
var g = {};
|
||||
g[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
return poisonedValue;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var f = ([x] = g) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding when value iteration was completed previously (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
d. If next is false, set iteratorRecord.[[done]] to true.
|
||||
e. Else,
|
||||
[...]
|
||||
i. Let v be IteratorValue(next).
|
||||
ii. If v is an abrupt completion, set
|
||||
iteratorRecord.[[done]] to true.
|
||||
iii. ReturnIfAbrupt(v).
|
||||
5. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
[...]
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([x, y, z] = [1, 2, 3]) => {
|
||||
assert.sameValue(x, 1);
|
||||
assert.sameValue(y, 2);
|
||||
assert.sameValue(z, 3);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with object binding pattern and initializer is used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) => {
|
||||
assert.sameValue(x, 44);
|
||||
assert.sameValue(y, 55);
|
||||
assert.sameValue(z, 66);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-obj-id.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with object binding pattern and initializer is not used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) => {
|
||||
assert.sameValue(x, 11);
|
||||
assert.sameValue(y, 22);
|
||||
assert.sameValue(z, 33);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,73 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with object binding pattern and initializer is used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) => {
|
||||
assert.sameValue(v, 444);
|
||||
assert.sameValue(x, 555);
|
||||
assert.sameValue(z, 666);
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
u;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
w;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
y;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,73 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: BindingElement with object binding pattern and initializer is not used (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) => {
|
||||
assert.sameValue(v, 777);
|
||||
assert.sameValue(x, 888);
|
||||
assert.sameValue(z, 999);
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
u;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
w;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
y;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Nested object destructuring with a null value (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPattern Initializeropt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
[...]
|
||||
e. Else
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ObjectBindingPattern
|
||||
|
||||
1. Let valid be RequireObjectCoercible(value).
|
||||
2. ReturnIfAbrupt(valid).
|
||||
---*/
|
||||
|
||||
var f = ([{ x }] = [null]) => {};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Nested object destructuring with a value of `undefined` (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPattern Initializeropt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
[...]
|
||||
e. Else
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ObjectBindingPattern
|
||||
|
||||
1. Let valid be RequireObjectCoercible(value).
|
||||
2. ReturnIfAbrupt(valid).
|
||||
---*/
|
||||
|
||||
var f = ([{ x }] = []) => {};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,68 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elision-exhausted.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Elision accepts exhausted iterator (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
ArrayBindingPattern : [ Elision ]
|
||||
|
||||
1. Return the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
|
||||
as the argument.
|
||||
|
||||
12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
|
||||
|
||||
Elision : ,
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
[...]
|
||||
2. Return NormalCompletion(empty).
|
||||
|
||||
---*/
|
||||
var iter = function*() {}();
|
||||
iter.next();
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([,] = iter) => {
|
||||
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elision-step-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Elision advances iterator and forwards abrupt completions (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
ArrayBindingPattern : [ Elision ]
|
||||
|
||||
1. Return the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
|
||||
as the argument.
|
||||
|
||||
12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
|
||||
|
||||
Elision : ,
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
|
||||
---*/
|
||||
var following = 0;
|
||||
var iter =function* () {
|
||||
throw new Test262Error();
|
||||
following += 1;
|
||||
}();
|
||||
|
||||
var f = ([,] = iter) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
||||
|
||||
iter.next();
|
||||
assert.sameValue(following, 0, 'Iterator was properly closed.');
|
|
@ -0,0 +1,77 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elision.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Elision advances iterator (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
ArrayBindingPattern : [ Elision ]
|
||||
|
||||
1. Return the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
|
||||
as the argument.
|
||||
|
||||
12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
|
||||
|
||||
Elision : ,
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
d. If next is false, set iteratorRecord.[[done]] to true.
|
||||
2. Return NormalCompletion(empty).
|
||||
|
||||
---*/
|
||||
var first = 0;
|
||||
var second = 0;
|
||||
function* g() {
|
||||
first += 1;
|
||||
yield;
|
||||
second += 1;
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([,] = g()) => {
|
||||
assert.sameValue(first, 1);
|
||||
assert.sameValue(second, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-empty.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: No iteration occurs for an "empty" array binding pattern (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generators, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
ArrayBindingPattern : [ ]
|
||||
|
||||
1. Return NormalCompletion(empty).
|
||||
|
||||
---*/
|
||||
var iterations = 0;
|
||||
var iter = function*() {
|
||||
iterations += 1;
|
||||
}();
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([] = iter) => {
|
||||
assert.sameValue(iterations, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,84 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element containing an array BindingElementList pattern (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingRestElement : ... BindingPattern
|
||||
|
||||
1. Let A be ArrayCreate(0).
|
||||
[...]
|
||||
3. Repeat
|
||||
[...]
|
||||
b. If iteratorRecord.[[done]] is true, then
|
||||
i. Return the result of performing BindingInitialization of
|
||||
BindingPattern with A and environment as the arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
d. If next is false, set iteratorRecord.[[done]] to true.
|
||||
e. Else,
|
||||
[...]
|
||||
i. Let v be IteratorValue(next).
|
||||
ii. If v is an abrupt completion, set
|
||||
iteratorRecord.[[done]] to true.
|
||||
iii. ReturnIfAbrupt(v).
|
||||
5. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
[...]
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...[x, y, z]] = [3, 4, 5]) => {
|
||||
assert.sameValue(x, 3);
|
||||
assert.sameValue(y, 4);
|
||||
assert.sameValue(z, 5);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,90 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element containing an elision (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generators, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingRestElement : ... BindingPattern
|
||||
|
||||
1. Let A be ArrayCreate(0).
|
||||
[...]
|
||||
3. Repeat
|
||||
[...]
|
||||
b. If iteratorRecord.[[done]] is true, then
|
||||
i. Return the result of performing BindingInitialization of
|
||||
BindingPattern with A and environment as the arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
ArrayBindingPattern : [ Elision ]
|
||||
|
||||
1. Return the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
|
||||
as the argument.
|
||||
|
||||
12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
|
||||
|
||||
Elision : ,
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
d. If next is false, set iteratorRecord.[[done]] to true.
|
||||
2. Return NormalCompletion(empty).
|
||||
|
||||
---*/
|
||||
var first = 0;
|
||||
var second = 0;
|
||||
function* g() {
|
||||
first += 1;
|
||||
yield;
|
||||
second += 1;
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...[,]] = g()) => {
|
||||
assert.sameValue(first, 1);
|
||||
assert.sameValue(second, 1);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,73 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element containing an "empty" array pattern (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generators, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingRestElement : ... BindingPattern
|
||||
|
||||
1. Let A be ArrayCreate(0).
|
||||
[...]
|
||||
3. Repeat
|
||||
[...]
|
||||
b. If iteratorRecord.[[done]] is true, then
|
||||
i. Return the result of performing BindingInitialization of
|
||||
BindingPattern with A and environment as the arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
ArrayBindingPattern : [ ]
|
||||
|
||||
1. Return NormalCompletion(empty).
|
||||
|
||||
---*/
|
||||
var iterations = 0;
|
||||
var iter = function*() {
|
||||
iterations += 1;
|
||||
}();
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...[]] = iter) => {
|
||||
assert.sameValue(iterations, 1);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element containing a rest element (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingRestElement : ... BindingPattern
|
||||
|
||||
1. Let A be ArrayCreate(0).
|
||||
[...]
|
||||
3. Repeat
|
||||
[...]
|
||||
b. If iteratorRecord.[[done]] is true, then
|
||||
i. Return the result of performing BindingInitialization of
|
||||
BindingPattern with A and environment as the arguments.
|
||||
[...]
|
||||
---*/
|
||||
var values = [1, 2, 3];
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...[...x]] = values) => {
|
||||
assert(Array.isArray(x));
|
||||
assert.sameValue(x.length, 3);
|
||||
assert.sameValue(x[0], 1);
|
||||
assert.sameValue(x[1], 2);
|
||||
assert.sameValue(x[2], 3);
|
||||
assert.notSameValue(x, values);
|
||||
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,57 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element following elision elements (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generators, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
ArrayBindingPattern : [ Elisionopt BindingRestElement ]
|
||||
1. If Elision is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with
|
||||
iteratorRecord as the argument.
|
||||
b. ReturnIfAbrupt(status).
|
||||
2. Return the result of performing IteratorBindingInitialization for
|
||||
BindingRestElement with iteratorRecord and environment as arguments.
|
||||
|
||||
---*/
|
||||
var iter = (function*() { throw new Test262Error(); })();
|
||||
|
||||
var f = ([, ...x] = iter) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,65 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-id-elision.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element following elision elements (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
ArrayBindingPattern : [ Elisionopt BindingRestElement ]
|
||||
1. If Elision is present, then
|
||||
a. Let status be the result of performing
|
||||
IteratorDestructuringAssignmentEvaluation of Elision with
|
||||
iteratorRecord as the argument.
|
||||
b. ReturnIfAbrupt(status).
|
||||
2. Return the result of performing IteratorBindingInitialization for
|
||||
BindingRestElement with iteratorRecord and environment as arguments.
|
||||
---*/
|
||||
var values = [1, 2, 3, 4, 5];
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([ , , ...x] = values) => {
|
||||
assert(Array.isArray(x));
|
||||
assert.sameValue(x.length, 3);
|
||||
assert.sameValue(x[0], 3);
|
||||
assert.sameValue(x[1], 4);
|
||||
assert.sameValue(x[2], 5);
|
||||
assert.notSameValue(x, values);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,61 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: RestElement applied to an exhausted iterator (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [Symbol.iterator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
BindingRestElement : ... BindingIdentifier
|
||||
1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
|
||||
environment).
|
||||
2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
|
||||
[...]
|
||||
b. If iteratorRecord.[[done]] is true, then
|
||||
i. If environment is undefined, return PutValue(lhs, A).
|
||||
ii. Return InitializeReferencedBinding(lhs, A).
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([, , ...x] = [1, 2]) => {
|
||||
assert(Array.isArray(x));
|
||||
assert.sameValue(x.length, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,68 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Error forwarding when IteratorStep returns an abrupt completion (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [generators, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
BindingRestElement : ... BindingIdentifier
|
||||
1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
|
||||
environment).
|
||||
2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
|
||||
a. If iteratorRecord.[[done]] is false,
|
||||
i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
|
||||
true.
|
||||
iii. ReturnIfAbrupt(next).
|
||||
|
||||
---*/
|
||||
var first = 0;
|
||||
var second = 0;
|
||||
var iter = function*() {
|
||||
first += 1;
|
||||
throw new Test262Error();
|
||||
second += 1;
|
||||
}();
|
||||
|
||||
var f = ([...x] = iter) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
||||
|
||||
iter.next();
|
||||
assert.sameValue(first, 1);
|
||||
assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
|
|
@ -0,0 +1,70 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Error forwarding when IteratorValue returns an abrupt completion (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [Symbol.iterator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
BindingRestElement : ... BindingIdentifier
|
||||
1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
|
||||
environment).
|
||||
2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
|
||||
[...]
|
||||
c. Let nextValue be IteratorValue(next).
|
||||
d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
|
||||
true.
|
||||
e. ReturnIfAbrupt(nextValue).
|
||||
|
||||
---*/
|
||||
var poisonedValue = Object.defineProperty({}, 'value', {
|
||||
get: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
var iter = {};
|
||||
iter[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
return poisonedValue;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var f = ([...x] = iter) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-id.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Lone rest element (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
BindingRestElement : ... BindingIdentifier
|
||||
[...] 3. Let A be ArrayCreate(0). [...] 5. Repeat
|
||||
[...]
|
||||
f. Let status be CreateDataProperty(A, ToString (n), nextValue).
|
||||
[...]
|
||||
---*/
|
||||
var values = [1, 2, 3];
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...x] = values) => {
|
||||
assert(Array.isArray(x));
|
||||
assert.sameValue(x.length, 3);
|
||||
assert.sameValue(x[0], 1);
|
||||
assert.sameValue(x[1], 2);
|
||||
assert.sameValue(x[2], 3);
|
||||
assert.notSameValue(x, values);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-init-ary.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Reset element (nested array pattern) does not support initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3 Destructuring Binding Patterns
|
||||
ArrayBindingPattern[Yield] :
|
||||
[ Elisionopt BindingRestElement[?Yield]opt ]
|
||||
[ BindingElementList[?Yield] ]
|
||||
[ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...[ x ] = []] = []) => {
|
||||
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-init-id.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Reset element (identifier) does not support initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3 Destructuring Binding Patterns
|
||||
ArrayBindingPattern[Yield] :
|
||||
[ Elisionopt BindingRestElement[?Yield]opt ]
|
||||
[ BindingElementList[?Yield] ]
|
||||
[ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...x = []] = []) => {
|
||||
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-init-obj.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Reset element (nested object pattern) does not support initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3 Destructuring Binding Patterns
|
||||
ArrayBindingPattern[Yield] :
|
||||
[ Elisionopt BindingRestElement[?Yield]opt ]
|
||||
[ BindingElementList[?Yield] ]
|
||||
[ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...{ x } = []] = []) => {
|
||||
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element (array binding pattern) may not be followed by any element (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3 Destructuring Binding Patterns
|
||||
ArrayBindingPattern[Yield] :
|
||||
[ Elisionopt BindingRestElement[?Yield]opt ]
|
||||
[ BindingElementList[?Yield] ]
|
||||
[ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...[x], y] = [1, 2, 3]) => {
|
||||
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element (identifier) may not be followed by any element (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3 Destructuring Binding Patterns
|
||||
ArrayBindingPattern[Yield] :
|
||||
[ Elisionopt BindingRestElement[?Yield]opt ]
|
||||
[ BindingElementList[?Yield] ]
|
||||
[ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...x, y] = [1, 2, 3]) => {
|
||||
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element (object binding pattern) may not be followed by any element (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3 Destructuring Binding Patterns
|
||||
ArrayBindingPattern[Yield] :
|
||||
[ Elisionopt BindingRestElement[?Yield]opt ]
|
||||
[ BindingElementList[?Yield] ]
|
||||
[ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...{ x }, y] = [1, 2, 3]) => {
|
||||
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-obj-id.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element containing an object binding pattern (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingRestElement : ... BindingPattern
|
||||
|
||||
1. Let A be ArrayCreate(0).
|
||||
[...]
|
||||
3. Repeat
|
||||
[...]
|
||||
b. If iteratorRecord.[[done]] is true, then
|
||||
i. Return the result of performing BindingInitialization of
|
||||
BindingPattern with A and environment as the arguments.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...{ length }] = [1, 2, 3]) => {
|
||||
assert.sameValue(length, 3);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,70 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Rest element containing an object binding pattern (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingRestElement : ... BindingPattern
|
||||
|
||||
1. Let A be ArrayCreate(0).
|
||||
[...]
|
||||
3. Repeat
|
||||
[...]
|
||||
b. If iteratorRecord.[[done]] is true, then
|
||||
i. Return the result of performing BindingInitialization of
|
||||
BindingPattern with A and environment as the arguments.
|
||||
[...]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) => {
|
||||
assert.sameValue(v, 7);
|
||||
assert.sameValue(w, 8);
|
||||
assert.sameValue(x, 9);
|
||||
assert.sameValue(y, undefined);
|
||||
assert.sameValue(z, 3);
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
length;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,51 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-init-null.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Value specifed for object binding pattern must be object coercible (null) (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
Runtime Semantics: BindingInitialization
|
||||
|
||||
ObjectBindingPattern : { }
|
||||
|
||||
1. Return NormalCompletion(empty).
|
||||
---*/
|
||||
|
||||
var f = ({} = null) => {};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,51 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-init-undefined.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Value specifed for object binding pattern must be object coercible (undefined) (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
Runtime Semantics: BindingInitialization
|
||||
|
||||
ObjectBindingPattern : { }
|
||||
|
||||
1. Return NormalCompletion(empty).
|
||||
---*/
|
||||
|
||||
var f = ({} = undefined) => {};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,61 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-empty.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: No property access occurs for an "empty" object binding pattern (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
Runtime Semantics: BindingInitialization
|
||||
|
||||
ObjectBindingPattern : { }
|
||||
|
||||
1. Return NormalCompletion(empty).
|
||||
---*/
|
||||
var accessCount = 0;
|
||||
var obj = Object.defineProperty({}, 'attr', {
|
||||
get: function() {
|
||||
accessCount += 1;
|
||||
}
|
||||
});
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({} = obj) => {
|
||||
assert.sameValue(accessCount, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,58 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-get-value-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Error thrown when accessing the corresponding property of the value object (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
4. Let v be GetV(value, propertyName).
|
||||
5. ReturnIfAbrupt(v).
|
||||
---*/
|
||||
var poisonedProperty = Object.defineProperty({}, 'poisoned', {
|
||||
get: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
var f = ({ poisoned } = poisonedProperty) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding assigns `name` to arrow functions (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
i. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
bindingId).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ arrow = () => {} } = {}) => {
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding assigns `name` to "anonymous" classes (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
i. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
bindingId).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ cls = class {}, xCls = class X {} } = {}) => {
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
assert.notSameValue(xCls.name, 'xCls');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
i. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
bindingId).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ cover = (function () {}), xCover = (0, function() {}) } = {}) => {
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
assert.notSameValue(xCover.name, 'xCover');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding assigns name to "anonymous" functions (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
i. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
bindingId).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ fn = function () {}, xFn = function x() {} } = {}) => {
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
assert.notSameValue(xFn.name, 'xFn');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding assigns name to "anonymous" generator functions (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
d. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
i. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
bindingId).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ gen = function* () {}, xGen = function* x() {} } = {}) => {
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
assert.notSameValue(xGen.name, 'xGen');
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,66 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-init-skipped.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer is not evaluated when value is not `undefined` (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
[...]
|
||||
---*/
|
||||
var initCount = 0;
|
||||
function counter() {
|
||||
initCount += 1;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) => {
|
||||
assert.sameValue(w, null);
|
||||
assert.sameValue(x, 0);
|
||||
assert.sameValue(y, false);
|
||||
assert.sameValue(z, '');
|
||||
assert.sameValue(initCount, 0);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,58 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-init-throws.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Error thrown when evaluating the initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
---*/
|
||||
function thrower() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
|
||||
var f = ({ x = thrower() } = {}) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer is an unresolvable reference (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
|
||||
6.2.3.1 GetValue (V)
|
||||
|
||||
1. ReturnIfAbrupt(V).
|
||||
2. If Type(V) is not Reference, return V.
|
||||
3. Let base be GetBase(V).
|
||||
4. If IsUnresolvableReference(V), throw a ReferenceError exception.
|
||||
---*/
|
||||
|
||||
var f = ({ x = unresolvableReference } = {}) => {};
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Trailing comma is allowed following BindingPropertyList (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3 Destructuring Binding Patterns
|
||||
|
||||
ObjectBindingPattern[Yield] :
|
||||
{ }
|
||||
{ BindingPropertyList[?Yield] }
|
||||
{ BindingPropertyList[?Yield] , }
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ x, } = { x: 23 }) => {
|
||||
assert.sameValue(x, 23);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,59 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-list-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Binding property list evaluation is interrupted by an abrupt completion (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPropertyList : BindingPropertyList , BindingProperty
|
||||
|
||||
1. Let status be the result of performing BindingInitialization for
|
||||
BindingPropertyList using value and environment as arguments.
|
||||
2. ReturnIfAbrupt(status).
|
||||
---*/
|
||||
var initCount = 0;
|
||||
function thrower() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
|
||||
var f = ({ a, b = thrower(), c = ++initCount } = {}) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
||||
|
||||
assert.sameValue(initCount, 0);
|
|
@ -0,0 +1,65 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-ary-init.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Object binding pattern with "nested" array binding pattern using initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
4. Return the result of performing BindingInitialization for BindingPattern
|
||||
passing v and environment as arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ w: [x, y, z] = [4, 5, 6] } = {}) => {
|
||||
assert.sameValue(x, 4);
|
||||
assert.sameValue(y, 5);
|
||||
assert.sameValue(z, 6);
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
w;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,56 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Trailing comma is allowed following BindingPropertyList (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3 Destructuring Binding Patterns
|
||||
|
||||
ObjectBindingPattern[Yield] :
|
||||
{ }
|
||||
{ BindingPropertyList[?Yield] }
|
||||
{ BindingPropertyList[?Yield] , }
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ x: [y], } = { x: [45] }) => {
|
||||
assert.sameValue(y,45);
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,53 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Object binding pattern with "nested" array binding pattern taking the `null` value (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization for BindingPattern
|
||||
passing v and environment as arguments.
|
||||
---*/
|
||||
|
||||
var f = ({ w: [x, y, z] = [4, 5, 6] } = { w: null }) => {};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-ary.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Object binding pattern with "nested" array binding pattern not using initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization for BindingPattern
|
||||
passing v and environment as arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) => {
|
||||
assert.sameValue(x, 7);
|
||||
assert.sameValue(y, undefined);
|
||||
assert.sameValue(z, undefined);
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
w;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,55 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-eval-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Evaluation of property name returns an abrupt completion (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingProperty : PropertyName : BindingElement
|
||||
|
||||
1. Let P be the result of evaluating PropertyName
|
||||
2. ReturnIfAbrupt(P).
|
||||
---*/
|
||||
function thrower() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
|
||||
var f = ({ [thrower()]: x } = {}) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Error thrown when accessing the corresponding property of the value object (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
BindingElement : BindingPattern Initializeropt
|
||||
|
||||
1. Let v be GetV(value, propertyName).
|
||||
2. ReturnIfAbrupt(v).
|
||||
---*/
|
||||
var initEvalCount = 0;
|
||||
var poisonedProperty = Object.defineProperty({}, 'poisoned', {
|
||||
get: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
var f = ({ poisoned: x = ++initEvalCount } = poisonedProperty) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
||||
|
||||
assert.sameValue(initEvalCount, 0);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer is not evaluated when value is not `undefined` (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
BindingElement : BindingPattern Initializeropt
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
---*/
|
||||
var initCount = 0;
|
||||
function counter() {
|
||||
initCount += 1;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) => {
|
||||
assert.sameValue(t, null);
|
||||
assert.sameValue(v, 0);
|
||||
assert.sameValue(x, false);
|
||||
assert.sameValue(z, '');
|
||||
assert.sameValue(initCount, 0);
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
s;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
u;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
w;
|
||||
});
|
||||
assert.throws(ReferenceError, function() {
|
||||
y;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,58 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Error thrown when evaluating the initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
BindingElement : BindingPattern Initializeropt
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
---*/
|
||||
function thrower() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
|
||||
var f = ({ x: y = thrower() } = {}) => {};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Destructuring initializer is an unresolvable reference (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
BindingElement : BindingPattern Initializeropt
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
|
||||
6.2.3.1 GetValue (V)
|
||||
|
||||
1. ReturnIfAbrupt(V).
|
||||
2. If Type(V) is not Reference, return V.
|
||||
3. Let base be GetBase(V).
|
||||
4. If IsUnresolvableReference(V), throw a ReferenceError exception.
|
||||
---*/
|
||||
|
||||
var f = ({ x: y = unresolvableReference } = {}) => {};
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,59 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-id-init.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Binding as specified via property name, identifier, and initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ x: y = 33 } = { }) => {
|
||||
assert.sameValue(y, 33);
|
||||
assert.throws(ReferenceError, function() {
|
||||
x;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Trailing comma is allowed following BindingPropertyList (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3 Destructuring Binding Patterns
|
||||
|
||||
ObjectBindingPattern[Yield] :
|
||||
{ }
|
||||
{ BindingPropertyList[?Yield] }
|
||||
{ BindingPropertyList[?Yield] , }
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ x: y, } = { x: 23 }) => {
|
||||
assert.sameValue(y, 23);
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
x;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,59 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-id.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Binding as specified via property name and identifier (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ x: y } = { x: 23 }) => {
|
||||
assert.sameValue(y, 23);
|
||||
assert.throws(ReferenceError, function() {
|
||||
x;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,65 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-obj-init.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Object binding pattern with "nested" object binding pattern using initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be GetValue(defaultValue).
|
||||
c. ReturnIfAbrupt(v).
|
||||
4. Return the result of performing BindingInitialization for BindingPattern
|
||||
passing v and environment as arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) => {
|
||||
assert.sameValue(x, 4);
|
||||
assert.sameValue(y, 5);
|
||||
assert.sameValue(z, 6);
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
w;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,53 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Object binding pattern with "nested" object binding pattern taking the `null` value (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization for BindingPattern
|
||||
passing v and environment as arguments.
|
||||
---*/
|
||||
|
||||
var f = ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) => {};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,53 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
|
||||
// - src/dstr-binding/error/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Object binding pattern with "nested" object binding pattern taking the `null` value (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization for BindingPattern
|
||||
passing v and environment as arguments.
|
||||
---*/
|
||||
|
||||
var f = ({ w: { x, y, z } = undefined } = { }) => {};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/obj-ptrn-prop-obj.case
|
||||
// - src/dstr-binding/default/arrow-function-dflt.template
|
||||
/*---
|
||||
description: Object binding pattern with "nested" object binding pattern not using initializer (arrow function expression (default parameter))
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.2.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
[...]
|
||||
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
[...]
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
|
||||
|
||||
[...]
|
||||
3. If Initializer is present and v is undefined, then
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization for BindingPattern
|
||||
passing v and environment as arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) => {
|
||||
assert.sameValue(x, undefined);
|
||||
assert.sameValue(y, undefined);
|
||||
assert.sameValue(z, 7);
|
||||
|
||||
assert.throws(ReferenceError, function() {
|
||||
w;
|
||||
});
|
||||
callCount = callCount + 1;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
|
@ -0,0 +1,97 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-init-iter-close.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: Iterator is closed when not exhausted by pattern evaluation (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [Symbol.iterator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ArrayBindingPattern
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator,
|
||||
result).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var doneCallCount = 0;
|
||||
var iter = {};
|
||||
iter[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
return { value: null, done: false };
|
||||
},
|
||||
return: function() {
|
||||
doneCallCount += 1;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([x] = iter) {
|
||||
assert.sameValue(doneCallCount, 1);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,84 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-init-iter-get-err.case
|
||||
// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: Abrupt completion returned by GetIterator (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [Symbol.iterator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ArrayBindingPattern
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
|
||||
---*/
|
||||
var iter = {};
|
||||
iter[Symbol.iterator] = function() {
|
||||
throw new Test262Error();
|
||||
};
|
||||
|
||||
var C = class {
|
||||
*method([x] = iter) {}
|
||||
};
|
||||
var c = new C();
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
c.method();
|
||||
});
|
|
@ -0,0 +1,97 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-init-iter-no-close.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: Iterator is not closed when exhausted by pattern evaluation (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [Symbol.iterator, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ArrayBindingPattern
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator,
|
||||
result).
|
||||
[...]
|
||||
|
||||
---*/
|
||||
var doneCallCount = 0;
|
||||
var iter = {};
|
||||
iter[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function() {
|
||||
return { value: null, done: true };
|
||||
},
|
||||
return: function() {
|
||||
doneCallCount += 1;
|
||||
return {};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([x] = iter) {
|
||||
assert.sameValue(doneCallCount, 0);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,96 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-name-iter-val.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: SingleNameBinding with normal value iteration (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
SingleNameBinding : BindingIdentifier Initializeropt
|
||||
|
||||
[...]
|
||||
4. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
|
||||
c. ReturnIfAbrupt(next).
|
||||
d. If next is false, set iteratorRecord.[[done]] to true.
|
||||
e. Else,
|
||||
[...]
|
||||
i. Let v be IteratorValue(next).
|
||||
ii. If v is an abrupt completion, set
|
||||
iteratorRecord.[[done]] to true.
|
||||
iii. ReturnIfAbrupt(v).
|
||||
5. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
[...]
|
||||
8. Return InitializeReferencedBinding(lhs, v).
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([x, y, z] = [1, 2, 3]) {
|
||||
assert.sameValue(x, 1);
|
||||
assert.sameValue(y, 2);
|
||||
assert.sameValue(z, 3);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,88 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([[x, y, z] = [4, 5, 6]] = []) {
|
||||
assert.sameValue(x, 4);
|
||||
assert.sameValue(y, 5);
|
||||
assert.sameValue(z, 6);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,89 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
[...]
|
||||
e. Else,
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
|
||||
assert.sameValue(x, 7);
|
||||
assert.sameValue(y, 8);
|
||||
assert.sameValue(z, 9);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,95 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [generators, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
|
||||
---*/
|
||||
var first = 0;
|
||||
var second = 0;
|
||||
function* g() {
|
||||
first += 1;
|
||||
yield;
|
||||
second += 1;
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([[,] = g()] = []) {
|
||||
assert.sameValue(first, 1);
|
||||
assert.sameValue(second, 0);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,92 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [generators, destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
[...]
|
||||
e. Else,
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
|
||||
---*/
|
||||
var callCount = 0;
|
||||
function* g() {
|
||||
callCount += 1;
|
||||
};
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([[,] = g()] = [[]]) {
|
||||
assert.sameValue(callCount, 0);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,90 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
var initCount = 0;
|
||||
var iterCount = 0;
|
||||
var iter = function*() { iterCount += 1; }();
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([[] = function() { initCount += 1; return iter; }()] = []) {
|
||||
assert.sameValue(initCount, 1);
|
||||
assert.sameValue(iterCount, 0);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,88 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
[...]
|
||||
e. Else,
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
var initCount = 0;
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([[] = function() { initCount += 1; }()] = [[23]]) {
|
||||
assert.sameValue(initCount, 0);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,92 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
[...]
|
||||
2. If iteratorRecord.[[done]] is true, let v be undefined.
|
||||
3. If Initializer is present and v is undefined, then
|
||||
a. Let defaultValue be the result of evaluating Initializer.
|
||||
b. Let v be ? GetValue(defaultValue).
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
var values = [2, 1, 3];
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([[...x] = values] = []) {
|
||||
assert(Array.isArray(x));
|
||||
assert.sameValue(x[0], 2);
|
||||
assert.sameValue(x[1], 1);
|
||||
assert.sameValue(x[2], 3);
|
||||
assert.sameValue(x.length, 3);
|
||||
assert.notSameValue(x, values);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,95 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
|
||||
// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPatternInitializer opt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
|
||||
[...]
|
||||
e. Else,
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
---*/
|
||||
var values = [2, 1, 3];
|
||||
var initCount = 0;
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method([[...x] = function() { initCount += 1; }()] = [values]) {
|
||||
assert(Array.isArray(x));
|
||||
assert.sameValue(x[0], 2);
|
||||
assert.sameValue(x[1], 1);
|
||||
assert.sameValue(x[2], 3);
|
||||
assert.sameValue(x.length, 3);
|
||||
assert.notSameValue(x, values);
|
||||
assert.sameValue(initCount, 0);
|
||||
callCount = callCount + 1;
|
||||
}
|
||||
};
|
||||
|
||||
new C().method().next();
|
||||
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
|
@ -0,0 +1,91 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
|
||||
// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template
|
||||
/*---
|
||||
description: Nested array destructuring with a null value (class expression method (default parameter))
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
es6id: 14.5.16
|
||||
features: [destructuring-binding, default-parameters]
|
||||
flags: [generated]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
1. If BindingIdentifieropt is not present, let className be undefined.
|
||||
2. Else, let className be StringValue of BindingIdentifier.
|
||||
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
|
||||
with argument className.
|
||||
[...]
|
||||
|
||||
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
21. For each ClassElement m in order from methods
|
||||
a. If IsStatic of m is false, then
|
||||
i. Let status be the result of performing
|
||||
PropertyDefinitionEvaluation for m with arguments proto and
|
||||
false.
|
||||
[...]
|
||||
|
||||
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
|
||||
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
1. Let propKey be the result of evaluating PropertyName.
|
||||
2. ReturnIfAbrupt(propKey).
|
||||
3. If the function code for this GeneratorMethod is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
4. Let scope be the running execution context's LexicalEnvironment.
|
||||
5. Let closure be GeneratorFunctionCreate(Method,
|
||||
StrictFormalParameters, GeneratorBody, scope, strict).
|
||||
|
||||
9.2.1 [[Call]] ( thisArgument, argumentsList)
|
||||
|
||||
[...]
|
||||
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
|
||||
|
||||
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
|
||||
[...]
|
||||
|
||||
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
|
||||
|
||||
[...]
|
||||
23. Let iteratorRecord be Record {[[iterator]]:
|
||||
CreateListIterator(argumentsList), [[done]]: false}.
|
||||
24. If hasDuplicates is true, then
|
||||
[...]
|
||||
25. Else,
|
||||
b. Let formalStatus be IteratorBindingInitialization for formals with
|
||||
iteratorRecord and env as arguments.
|
||||
[...]
|
||||
|
||||
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
|
||||
|
||||
BindingElement : BindingPattern Initializeropt
|
||||
|
||||
1. If iteratorRecord.[[done]] is false, then
|
||||
[...]
|
||||
e. Else
|
||||
i. Let v be IteratorValue(next).
|
||||
[...]
|
||||
4. Return the result of performing BindingInitialization of BindingPattern
|
||||
with v and environment as the arguments.
|
||||
|
||||
13.3.3.5 Runtime Semantics: BindingInitialization
|
||||
|
||||
BindingPattern : ArrayBindingPattern
|
||||
|
||||
1. Let iterator be GetIterator(value).
|
||||
2. ReturnIfAbrupt(iterator).
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
*method([[x]] = [null]) {}
|
||||
};
|
||||
var c = new C();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
c.method();
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue