mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 07:54:41 +02:00
Generate tests
This commit is contained in:
parent
71f9559f11
commit
e5f1740411
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/arrow-function.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (arrow function expression)
|
||||||
|
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.2.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = (_ = (function() { throw new Test262Error(); }())) => {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'arrow function body not evaluated');
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/arrow-function.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (arrow function expression)
|
||||||
|
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.2.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = (aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) => {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
f(false, '', NaN, 0, null, obj);
|
||||||
|
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,65 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/arrow-function.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (arrow function expression)
|
||||||
|
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.2.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = (fromLiteral = 23, fromExpr = 45, fromHole = 99) => {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
f(undefined, void 0);
|
||||||
|
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
@ -0,0 +1,57 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/arrow-function.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (arrow function expression)
|
||||||
|
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.2.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, (x = 0, x) => {
|
||||||
|
|
||||||
|
};
|
@ -0,0 +1,62 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/arrow-function.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (arrow function expression)
|
||||||
|
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.2.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = (x = y, y) => {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'arrow function body not evaluated');
|
@ -0,0 +1,62 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/arrow-function.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (arrow function expression)
|
||||||
|
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.2.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = (x, y = x, z = y) => {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
f(3);
|
||||||
|
assert.sameValue(callCount, 1, 'arrow function invoked exactly once');
|
@ -0,0 +1,62 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/arrow-function.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (arrow function expression)
|
||||||
|
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.2.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = (x = x) => {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'arrow function body not evaluated');
|
62
test/language/expressions/arrow-function/params-dflt-rest.js
Normal file
62
test/language/expressions/arrow-function/params-dflt-rest.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/arrow-function.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (arrow function expression)
|
||||||
|
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.2.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, (...x = []) => {
|
||||||
|
|
||||||
|
};
|
@ -0,0 +1,86 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/cls-expr-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
*method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,108 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-expr-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
*method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.prototype.method(false, '', NaN, 0, null, obj).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,91 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-expr-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
*method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.prototype.method(undefined, void 0).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,83 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/cls-expr-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, class {
|
||||||
|
*method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,87 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/cls-expr-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
*method(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/cls-expr-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
*method(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.prototype.method(3).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,87 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/cls-expr-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
*method(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
88
test/language/expressions/class/params-dflt-gen-meth-rest.js
Normal file
88
test/language/expressions/class/params-dflt-gen-meth-rest.js
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/cls-expr-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, class {
|
||||||
|
*method(...x = []) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,86 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/cls-expr-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (static class expression generator method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation
|
||||||
|
for m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static *method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,108 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-expr-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (static class expression generator method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation
|
||||||
|
for m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.method(false, '', NaN, 0, null, obj).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,91 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-expr-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (static class expression generator method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation
|
||||||
|
for m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.method(undefined, void 0).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,83 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/cls-expr-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression generator method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation
|
||||||
|
for m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, class {
|
||||||
|
static *method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,87 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/cls-expr-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (static class expression generator method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation
|
||||||
|
for m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static *method(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/cls-expr-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (static class expression generator method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation
|
||||||
|
for m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static *method(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.method(3).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,87 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/cls-expr-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (static class expression generator method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation
|
||||||
|
for m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static *method(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/cls-expr-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (static class expression generator method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation
|
||||||
|
for m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, class {
|
||||||
|
static *method(...x = []) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
83
test/language/expressions/class/params-dflt-meth-abrupt.js
Normal file
83
test/language/expressions/class/params-dflt-meth-abrupt.js
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/cls-expr-meth.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,105 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-expr-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.prototype.method(false, '', NaN, 0, null, obj);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-expr-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.prototype.method(undefined, void 0);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,80 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/cls-expr-meth.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, class {
|
||||||
|
method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/cls-expr-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
method(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,85 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/cls-expr-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
method(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.prototype.method(3);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
84
test/language/expressions/class/params-dflt-meth-ref-self.js
Normal file
84
test/language/expressions/class/params-dflt-meth-ref-self.js
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/cls-expr-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
method(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
85
test/language/expressions/class/params-dflt-meth-rest.js
Normal file
85
test/language/expressions/class/params-dflt-meth-rest.js
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/cls-expr-meth.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, class {
|
||||||
|
method(...x = []) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,83 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/cls-expr-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (static class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,105 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-expr-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (static class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.method(false, '', NaN, 0, null, obj);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-expr-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (static class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.method(undefined, void 0);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,80 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/cls-expr-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, class {
|
||||||
|
static method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/cls-expr-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (static class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static method(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,85 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/cls-expr-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (static class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static method(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
C.method(3);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/cls-expr-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (static class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var C = class {
|
||||||
|
static method(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,85 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/cls-expr-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (static class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, class {
|
||||||
|
static method(...x = []) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
62
test/language/expressions/function/params-dflt-abrupt.js
Normal file
62
test/language/expressions/function/params-dflt-abrupt.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (function expression)
|
||||||
|
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.1.20
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'function body not evaluated');
|
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (function expression)
|
||||||
|
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.1.20
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
f(false, '', NaN, 0, null, obj);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'function invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,67 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (function expression)
|
||||||
|
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.1.20
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
f(undefined, void 0);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'function invoked exactly once');
|
58
test/language/expressions/function/params-dflt-duplicates.js
Normal file
58
test/language/expressions/function/params-dflt-duplicates.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/func-expr.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (function expression)
|
||||||
|
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.1.20
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, function(x = 0, x) {
|
||||||
|
|
||||||
|
};
|
63
test/language/expressions/function/params-dflt-ref-later.js
Normal file
63
test/language/expressions/function/params-dflt-ref-later.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (function expression)
|
||||||
|
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.1.20
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'function body not evaluated');
|
64
test/language/expressions/function/params-dflt-ref-prior.js
Normal file
64
test/language/expressions/function/params-dflt-ref-prior.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (function expression)
|
||||||
|
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.1.20
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
f(3);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'function invoked exactly once');
|
63
test/language/expressions/function/params-dflt-ref-self.js
Normal file
63
test/language/expressions/function/params-dflt-ref-self.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (function expression)
|
||||||
|
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.1.20
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'function body not evaluated');
|
63
test/language/expressions/function/params-dflt-rest.js
Normal file
63
test/language/expressions/function/params-dflt-rest.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/func-expr.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (function expression)
|
||||||
|
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.1.20
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, function(...x = []) {
|
||||||
|
|
||||||
|
};
|
62
test/language/expressions/generators/params-dflt-abrupt.js
Normal file
62
test/language/expressions/generators/params-dflt-abrupt.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/gen-func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (generator function expression)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.4.14
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function*(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'generator function body not evaluated');
|
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/gen-func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (generator function expression)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.4.14
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function*(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
f(false, '', NaN, 0, null, obj).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,67 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/gen-func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (generator function expression)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.4.14
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function*(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
f(undefined, void 0).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
|
@ -0,0 +1,58 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/gen-func-expr.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (generator function expression)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.4.14
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, function*(x = 0, x) {
|
||||||
|
|
||||||
|
};
|
@ -0,0 +1,63 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/gen-func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (generator function expression)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.4.14
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function*(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'generator function body not evaluated');
|
@ -0,0 +1,64 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/gen-func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (generator function expression)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.4.14
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function*(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
f(3).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
|
63
test/language/expressions/generators/params-dflt-ref-self.js
Normal file
63
test/language/expressions/generators/params-dflt-ref-self.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/gen-func-expr.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (generator function expression)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.4.14
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var f;
|
||||||
|
f = function*(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
f();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'generator function body not evaluated');
|
63
test/language/expressions/generators/params-dflt-rest.js
Normal file
63
test/language/expressions/generators/params-dflt-rest.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/gen-func-expr.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (generator function expression)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.4.14
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, function*(...x = []) {
|
||||||
|
|
||||||
|
};
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (generator method)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
|
||||||
|
es6id: 14.4.13
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
*method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
obj.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'generator method body not evaluated');
|
@ -0,0 +1,90 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (generator method)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
|
||||||
|
es6id: 14.4.13
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
*method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.method(false, '', NaN, 0, null, obj).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'generator method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,73 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (generator method)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
|
||||||
|
es6id: 14.4.13
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
*method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.method(undefined, void 0).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'generator method invoked exactly once');
|
@ -0,0 +1,65 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (generator method)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
|
||||||
|
es6id: 14.4.13
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, {
|
||||||
|
*method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,69 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (generator method)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
|
||||||
|
es6id: 14.4.13
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
*method(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
obj.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'generator method body not evaluated');
|
@ -0,0 +1,70 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (generator method)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
|
||||||
|
es6id: 14.4.13
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
*method(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.method(3).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'generator method invoked exactly once');
|
@ -0,0 +1,69 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (generator method)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
|
||||||
|
es6id: 14.4.13
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
*method(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
obj.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'generator method body not evaluated');
|
@ -0,0 +1,70 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (generator method)
|
||||||
|
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
|
||||||
|
es6id: 14.4.13
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, {
|
||||||
|
*method(...x = []) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,65 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/meth.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (method)
|
||||||
|
esid: sec-runtime-semantics-definemethod
|
||||||
|
es6id: 14.3.8
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters,
|
||||||
|
FunctionBody, scope, strict). If functionPrototype was passed as a
|
||||||
|
parameter then pass its value as the functionPrototype optional argument
|
||||||
|
of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
obj.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,87 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (method)
|
||||||
|
esid: sec-runtime-semantics-definemethod
|
||||||
|
es6id: 14.3.8
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters,
|
||||||
|
FunctionBody, scope, strict). If functionPrototype was passed as a
|
||||||
|
parameter then pass its value as the functionPrototype optional argument
|
||||||
|
of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.method(false, '', NaN, 0, null, obj);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,70 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (method)
|
||||||
|
esid: sec-runtime-semantics-definemethod
|
||||||
|
es6id: 14.3.8
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters,
|
||||||
|
FunctionBody, scope, strict). If functionPrototype was passed as a
|
||||||
|
parameter then pass its value as the functionPrototype optional argument
|
||||||
|
of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.method(undefined, void 0);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,62 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/meth.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (method)
|
||||||
|
esid: sec-runtime-semantics-definemethod
|
||||||
|
es6id: 14.3.8
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters,
|
||||||
|
FunctionBody, scope, strict). If functionPrototype was passed as a
|
||||||
|
parameter then pass its value as the functionPrototype optional argument
|
||||||
|
of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, {
|
||||||
|
method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,66 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (method)
|
||||||
|
esid: sec-runtime-semantics-definemethod
|
||||||
|
es6id: 14.3.8
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters,
|
||||||
|
FunctionBody, scope, strict). If functionPrototype was passed as a
|
||||||
|
parameter then pass its value as the functionPrototype optional argument
|
||||||
|
of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
method(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
obj.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,67 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (method)
|
||||||
|
esid: sec-runtime-semantics-definemethod
|
||||||
|
es6id: 14.3.8
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters,
|
||||||
|
FunctionBody, scope, strict). If functionPrototype was passed as a
|
||||||
|
parameter then pass its value as the functionPrototype optional argument
|
||||||
|
of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
method(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.method(3);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,66 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (method)
|
||||||
|
esid: sec-runtime-semantics-definemethod
|
||||||
|
es6id: 14.3.8
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters,
|
||||||
|
FunctionBody, scope, strict). If functionPrototype was passed as a
|
||||||
|
parameter then pass its value as the functionPrototype optional argument
|
||||||
|
of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
var obj = {
|
||||||
|
method(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
obj.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,67 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/meth.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (method)
|
||||||
|
esid: sec-runtime-semantics-definemethod
|
||||||
|
es6id: 14.3.8
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters,
|
||||||
|
FunctionBody, scope, strict). If functionPrototype was passed as a
|
||||||
|
parameter then pass its value as the functionPrototype optional argument
|
||||||
|
of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
0, {
|
||||||
|
method(...x = []) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/cls-decl-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
*method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,106 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-decl-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
*method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.prototype.method(false, '', NaN, 0, null, obj).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-decl-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
*method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.prototype.method(undefined, void 0).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,81 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/cls-decl-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
class C {
|
||||||
|
*method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/cls-decl-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
*method(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,86 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/cls-decl-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
*method(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.prototype.method(3).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,85 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/cls-decl-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
*method(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
86
test/language/statements/class/params-dflt-gen-meth-rest.js
Normal file
86
test/language/statements/class/params-dflt-gen-meth-rest.js
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/cls-decl-gen-meth.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (class expression method)
|
||||||
|
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||||
|
es6id: 14.5.16
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
class C {
|
||||||
|
*method(...x = []) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/cls-decl-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (static class expression generator method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
static *method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,106 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-decl-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (static class expression generator method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
static *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.method(false, '', NaN, 0, null, obj).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-decl-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (static class expression generator method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
static *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.method(undefined, void 0).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,81 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/cls-decl-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression generator method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
class C {
|
||||||
|
static *method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/cls-decl-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (static class expression generator method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
static *method(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,86 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/cls-decl-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (static class expression generator method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
static *method(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.method(3).next();
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,86 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/cls-decl-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (static class expression generator method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
static *method(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,86 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/cls-decl-gen-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (static class expression generator method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F 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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
class C {
|
||||||
|
static *method(...x = []) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
82
test/language/statements/class/params-dflt-meth-abrupt.js
Normal file
82
test/language/statements/class/params-dflt-meth-abrupt.js
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/cls-decl-meth.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,104 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-decl-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.prototype.method(false, '', NaN, 0, null, obj);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,87 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-decl-meth.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.prototype.method(undefined, void 0);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,79 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/cls-decl-meth.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
class C {
|
||||||
|
method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
83
test/language/statements/class/params-dflt-meth-ref-later.js
Normal file
83
test/language/statements/class/params-dflt-meth-ref-later.js
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-later.case
|
||||||
|
// - src/dflt-params/error/cls-decl-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs later in the ParameterList (class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
method(x = y, y) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
84
test/language/statements/class/params-dflt-meth-ref-prior.js
Normal file
84
test/language/statements/class/params-dflt-meth-ref-prior.js
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-prior.case
|
||||||
|
// - src/dflt-params/default/cls-decl-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter that occurs earlier in the ParameterList (class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
method(x, y = x, z = y) {
|
||||||
|
assert.sameValue(x, 3, 'first argument value');
|
||||||
|
assert.sameValue(y, 3, 'second argument value');
|
||||||
|
assert.sameValue(z, 3, 'third argument value');
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.prototype.method(3);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
83
test/language/statements/class/params-dflt-meth-ref-self.js
Normal file
83
test/language/statements/class/params-dflt-meth-ref-self.js
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/ref-self.case
|
||||||
|
// - src/dflt-params/error/cls-decl-meth.template
|
||||||
|
/*---
|
||||||
|
description: Referencing a parameter from within its own initializer (class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
var x = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
method(x = x) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
C.prototype.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
84
test/language/statements/class/params-dflt-meth-rest.js
Normal file
84
test/language/statements/class/params-dflt-meth-rest.js
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/rest.case
|
||||||
|
// - src/dflt-params/syntax/cls-decl-meth.template
|
||||||
|
/*---
|
||||||
|
description: RestParameter does not support an initializer (class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1 Function Definitions
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
FunctionRestParameter[Yield] :
|
||||||
|
|
||||||
|
BindingRestElement[?Yield]
|
||||||
|
|
||||||
|
13.3.3 Destructuring Binding Patterns
|
||||||
|
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
BindingRestElement[Yield] :
|
||||||
|
|
||||||
|
...BindingIdentifier[?Yield]
|
||||||
|
...BindingPattern[?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
class C {
|
||||||
|
method(...x = []) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/abrupt.case
|
||||||
|
// - src/dflt-params/error/cls-decl-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion returned by evaluation of initializer (static class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
1. Let status be the result of performing IteratorBindingInitialization for
|
||||||
|
FormalsList using iteratorRecord and environment as the arguments.
|
||||||
|
2. ReturnIfAbrupt(status).
|
||||||
|
3. Return the result of performing IteratorBindingInitialization for
|
||||||
|
FormalParameter using iteratorRecord and environment as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
static method(_ = (function() { throw new Test262Error(); }())) {
|
||||||
|
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
C.method();
|
||||||
|
});
|
||||||
|
assert.sameValue(callCount, 0, 'method body not evaluated');
|
@ -0,0 +1,104 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-not-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-decl-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is not `undefined` (static class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
var obj = {};
|
||||||
|
var falseCount = 0;
|
||||||
|
var stringCount = 0;
|
||||||
|
var nanCount = 0;
|
||||||
|
var zeroCount = 0;
|
||||||
|
var nullCount = 0;
|
||||||
|
var objCount = 0;
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
static method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
|
||||||
|
assert.sameValue(aFalse, false);
|
||||||
|
assert.sameValue(aString, '');
|
||||||
|
assert.sameValue(aNaN, NaN);
|
||||||
|
assert.sameValue(a0, 0);
|
||||||
|
assert.sameValue(aNull, null);
|
||||||
|
assert.sameValue(aObj, obj);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.method(false, '', NaN, 0, null, obj);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
||||||
|
|
||||||
|
assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
|
||||||
|
assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
|
||||||
|
assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
|
||||||
|
assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
|
||||||
|
assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
|
||||||
|
assert.sameValue(objCount, 0, 'initializer not evaluated: object');
|
@ -0,0 +1,87 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/arg-val-undefined.case
|
||||||
|
// - src/dflt-params/default/cls-decl-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: Use of intializer when argument value is `undefined` (static class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.19 Runtime Semantics: IteratorBindingInitialization
|
||||||
|
|
||||||
|
FormalsList : FormalsList , FormalParameter
|
||||||
|
|
||||||
|
[...]
|
||||||
|
23. Let iteratorRecord be Record {[[Iterator]]:
|
||||||
|
CreateListIterator(argumentsList), [[Done]]: false}.
|
||||||
|
24. If hasDuplicates is true, then
|
||||||
|
[...]
|
||||||
|
25. Else,
|
||||||
|
a. Perform ? IteratorBindingInitialization for formals with
|
||||||
|
iteratorRecord and env as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
class C {
|
||||||
|
static method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
|
||||||
|
assert.sameValue(fromLiteral, 23);
|
||||||
|
assert.sameValue(fromExpr, 45);
|
||||||
|
assert.sameValue(fromHole, 99);
|
||||||
|
callCount = callCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
C.method(undefined, void 0);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1, 'method invoked exactly once');
|
@ -0,0 +1,79 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/dflt-params/duplicates.case
|
||||||
|
// - src/dflt-params/syntax/cls-decl-meth-static.template
|
||||||
|
/*---
|
||||||
|
description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression method)
|
||||||
|
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
|
||||||
|
es6id: 14.5.15
|
||||||
|
features: [default-parameters]
|
||||||
|
flags: [generated]
|
||||||
|
negative: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassDeclaration : class BindingIdentifier ClassTail
|
||||||
|
|
||||||
|
1. Let className be StringValue of BindingIdentifier.
|
||||||
|
2. 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
|
||||||
|
b. Else,
|
||||||
|
Let status be the result of performing PropertyDefinitionEvaluation for
|
||||||
|
m with arguments F and false.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.3.8 Runtime Semantics: DefineMethod
|
||||||
|
|
||||||
|
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||||
|
|
||||||
|
[...]
|
||||||
|
6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
|
||||||
|
scope, strict). If functionPrototype was passed as a parameter then pass its
|
||||||
|
value as the functionPrototype optional argument of FunctionCreate.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
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.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
14.1.2 Static Semantics: Early Errors
|
||||||
|
|
||||||
|
StrictFormalParameters : FormalParameters
|
||||||
|
|
||||||
|
- It is a Syntax Error if BoundNames of FormalParameters contains any
|
||||||
|
duplicate elements.
|
||||||
|
|
||||||
|
FormalParameters : FormalParameterList
|
||||||
|
|
||||||
|
- It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
|
||||||
|
false and BoundNames of FormalParameterList contains any duplicate
|
||||||
|
elements.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
class C {
|
||||||
|
static method(x = 0, x) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user