Add initial set of generated test sources

This commit is contained in:
Mike Pennisi 2016-03-16 13:58:29 -04:00
parent c5b9716144
commit 74bff6b3d5
53 changed files with 2958 additions and 0 deletions

View File

@ -244,3 +244,37 @@ p.then(function () {
```
As above, exceptions that are thrown from a `then` clause are passed to a later `$DONE` function and reported asynchronously.
## Procedurally-generated tests
Some language features are expressed through a number of distinct syntactic forms. Test262 maintains these tests as a set of "test cases" and "test templates" in order to ensure equivalent coverage across all forms. The sub-directories within the `src/` directory describe the various language features that benefit from this approach.
Test cases and test templates specify meta-data using the same YAML frontmatter pattern as so-called "static" (i.e. non-generated) tests. The expected attributes differ between test cases and test templates:
- test cases (`*.case`)
- `template` - name of the sub-directory to locate templates for this test
- `description` (see above)
- `info` (see above)
- `features` (see above; merged with value defined by test template)
- test templates (`*.template`)
- `path` - location within the published test hierarchy to output files created from this template
- `name` - human-readable name of the syntactic form described by this template (used to generate the test file's `description` field)
- `esid` (see above)
- `es5id` (see above)
- `es6id` (see above)
- `info` (see above)
- `features` (see above; merged with value defined by test case)
Generated files are managed using the `make.py` Python script located in the root of this repository.
To create files:
make.py
To remove all generated files:
make.py clean
The executable located at `tools/generation/generator.py` offers additional control over the generation procedure.
./tools/generation/generator.py --help

57
make.py Executable file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env python
# Copyright (C) 2016 the V8 project authors. All rights reserved.
# This code is governed by the BSD license found in the LICENSE file.
import os, shutil, subprocess, sys
OUT_DIR = os.environ.get('OUT_DIR') or 'test'
SRC_DIR = os.environ.get('SRC_DIR') or 'src'
def shell(*args):
sp = subprocess.Popen(list(args), stdout=subprocess.PIPE)
cmd_str = ' '.join(args)
print '> ' + cmd_str
for line in iter(sp.stdout.readline, ''):
sys.stdout.write(line)
sp.communicate()
if sp.returncode == 1:
raise Exception('Command failed: ' + cmd_str)
targets = dict()
def target(*deps):
def other(orig):
def wrapped():
print 'Running target: ' + orig.__name__
for dep in deps:
targets[dep]()
return orig()
wrapped.__name__ = orig.__name__
targets[orig.__name__] = wrapped
return wrapped
return other
@target()
def build():
shell(sys.executable, 'tools/generation/generator.py',
'create',
'--out', OUT_DIR,
SRC_DIR)
@target()
def clean():
shell(sys.executable, 'tools/generation/generator.py', 'clean', OUT_DIR)
if len(sys.argv) == 1:
targets['build']()
for target in sys.argv[1:]:
if not target in targets:
sys.stderr.write('No target named: "' + target + '".\n' +
'Available targets: ' + ', '.join(list(targets)) + '\n')
sys.exit(1)
targets[target]()

View File

@ -0,0 +1,35 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: SingleNameBinding with normal value iteration
template: default
info: |
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
//- elems
[x, y, z]
//- vals
[1, 2, 3]
//- body
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);

View File

@ -0,0 +1,46 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/arrow-function/dstr-
name: arrow function expression
es6id: 14.2.16
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.
[...]
---*/
var callCount = 0;
var f;
f = (/*{ elems }*/) => {
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ vals }*/);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,69 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/dstr-gen-meth-static-
name: static class expression generator method
es6id: 14.5.15
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.
[...]
---*/
var callCount = 0;
class C {
static *method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.method(/*{ vals }*/).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,69 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/dstr-gen-meth-
name: class expression method
es6id: 14.5.16
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.
[...]
---*/
var callCount = 0;
class C {
*method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
new C().method(/*{ vals }*/).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,67 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/dstr-meth-static-
name: static class expression method
es6id: 14.5.15
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.
[...]
---*/
var callCount = 0;
class C {
static method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.method(/*{ vals }*/);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,67 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/class/dstr-meth-
name: class expression method
es6id: 14.5.15
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.
[...]
---*/
var callCount = 0;
class C {
method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
new C().method(/*{ vals }*/);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,71 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/dstr-gen-meth-static-
name: static class expression generator method
es6id: 14.5.16
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.
[...]
---*/
var callCount = 0;
var C = class {
static *method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.method(/*{ vals }*/).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,71 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/dstr-gen-meth-
name: class expression method
es6id: 14.5.16
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.
[...]
---*/
var callCount = 0;
var C = class {
*method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
new C().method(/*{ vals }*/).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,68 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/dstr-meth-static-
name: static class expression method
es6id: 14.5.16
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.
[...]
---*/
var callCount = 0;
var C = class {
static method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.method(/*{ vals }*/);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,68 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/dstr-meth-
name: class expression method
es6id: 14.5.16
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.
[...]
---*/
var callCount = 0;
var C = class {
method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
new C().method(/*{ vals }*/);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,21 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/const/dstr-
name: >
`const` statement
es6id: 13.3.1.4
info: |
LexicalBinding : BindingPattern Initializer
1. Let rhs be the result of evaluating Initializer.
2. Let value be GetValue(rhs).
3. ReturnIfAbrupt(value).
4. Let env be the running execution context's LexicalEnvironment.
5. Return the result of performing BindingInitialization for BindingPattern
using value and env as the arguments.
---*/
const /*{ elems }*/ = /*{ vals }*/;
/*{ body }*/

View File

@ -0,0 +1,46 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/function/dstr-
name: function declaration
es6id: 14.1.19
info: |
FunctionDeclaration :
function BindingIdentifier ( FormalParameters ) { FunctionBody }
[...]
3. Let F 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.
[...]
---*/
var callCount = 0;
function f(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ vals }*/);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,47 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/function/dstr-
name: function expression
es6id: 14.1.20
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.
[...]
---*/
var callCount = 0;
var f;
f = function(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ vals }*/);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,45 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/generators/dstr-
name: generator function declaration
es6id: 14.4.12
info: |
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
[...]
2. Let F 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.
[...]
---*/
var callCount = 0;
function* f(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ vals }*/).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,47 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/generators/dstr-
name: generator function expression
es6id: 14.4.14
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.
[...]
---*/
var callCount = 0;
var f;
f = function*(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ vals }*/).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,53 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/dstr-gen-meth-
name: generator method
es6id: 14.4.13
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.
[...]
---*/
var callCount = 0;
var obj = {
*method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
obj.method(/*{ vals }*/).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,21 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/let/dstr-
name: >
`let` statement
es6id: 13.3.1.4
info: |
LexicalBinding : BindingPattern Initializer
1. Let rhs be the result of evaluating Initializer.
2. Let value be GetValue(rhs).
3. ReturnIfAbrupt(value).
4. Let env be the running execution context's LexicalEnvironment.
5. Return the result of performing BindingInitialization for BindingPattern
using value and env as the arguments.
---*/
let /*{ elems }*/ = /*{ vals }*/;
/*{ body }*/

View File

@ -0,0 +1,50 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/dstr-meth-
name: method
es6id: 14.3.8
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.
[...]
---*/
var callCount = 0;
var obj = {
method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
obj.method(/*{ vals }*/);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/variable/dstr-
name: >
`var` statement
es6id: 13.3.2.4
info: |
VariableDeclaration : BindingPattern Initializer
1. Let rhs be the result of evaluating Initializer.
2. Let rval be GetValue(rhs).
3. ReturnIfAbrupt(rval).
4. Return the result of performing BindingInitialization for
BindingPattern passing rval and undefined as arguments.
---*/
var /*{ elems }*/ = /*{ vals }*/;
/*{ body }*/

View File

@ -0,0 +1,28 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/call/spread-
name: CallExpression
es6id: 12.3.4.1
info: |
CallExpression : MemberExpression Arguments
[...]
9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall).
12.3.4.3 Runtime Semantics: EvaluateDirectCall
1. Let argList be ArgumentListEvaluation(arguments).
[...]
6. Let result be Call(func, thisValue, argList).
[...]
---*/
var callCount = 0;
(function(/*{ params }*/) {
/*{ body }*/
callCount += 1;
}(/*{ args }*/));
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,28 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/new/spread-
name: >
`new` operator
es6id: 12.3.3.1
info: |
MemberExpression : new MemberExpression Arguments
1. Return EvaluateNew(MemberExpression, Arguments).
12.3.3.1.1 Runtime Semantics: EvaluateNew
6. If arguments is empty, let argList be an empty List.
7. Else,
a. Let argList be ArgumentListEvaluation of arguments.
[...]
---*/
var callCount = 0;
new function(/*{ params }*/) {
/*{ body }*/
callCount += 1;
}(/*{ args }*/);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,34 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/super/spread-
name: SuperCall
es6id: 12.3.5.1
info: |
SuperCall : super Arguments
1. Let newTarget be GetNewTarget().
2. If newTarget is undefined, throw a ReferenceError exception.
3. Let func be GetSuperConstructor().
4. ReturnIfAbrupt(func).
5. Let argList be ArgumentListEvaluation of Arguments.
[...]
---*/
var callCount = 0;
class Test262ParentClass {
constructor(/*{ params }*/) {
/*{ body }*/
callCount += 1;
}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(/*{ args }*/);
}
}
new Test262ChildClass();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/call/spread-err-
name: CallExpression
es6id: 12.3.4.1
info: |
CallExpression : MemberExpression Arguments
[...]
9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall).
12.3.4.3 Runtime Semantics: EvaluateDirectCall
1. Let argList be ArgumentListEvaluation(arguments).
[...]
6. Let result be Call(func, thisValue, argList).
[...]
---*/
assert.throws(/*{ error }*/, function() {
(function(/*{ params }*/) {}(/*{ args }*/));
});

View File

@ -0,0 +1,23 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/new/spread-err-
name: >
`new` operator
es6id: 12.3.3.1
info: |
MemberExpression : new MemberExpression Arguments
1. Return EvaluateNew(MemberExpression, Arguments).
12.3.3.1.1 Runtime Semantics: EvaluateNew
6. If arguments is empty, let argList be an empty List.
7. Else,
a. Let argList be ArgumentListEvaluation of arguments.
[...]
---*/
assert.throws(/*{ error }*/, function() {
new function(/*{ params }*/) {}(/*{ args }*/);
});

View File

@ -0,0 +1,30 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/super/spread-err-
name: SuperCall
es6id: 12.3.5.1
info: |
SuperCall : super Arguments
1. Let newTarget be GetNewTarget().
2. If newTarget is undefined, throw a ReferenceError exception.
3. Let func be GetSuperConstructor().
4. ReturnIfAbrupt(func).
5. Let argList be ArgumentListEvaluation of Arguments.
[...]
---*/
class Test262ParentClass {
constructor(/*{ params }*/) {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(/*{ args }*/);
}
}
assert.throws(/*{ error }*/, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,22 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Spread operator applied to the only argument when evaluation throws
template: error
features: [generators]
info: |
12.3.6.1 Runtime Semantics: ArgumentListEvaluation
ArgumentList : ... AssignmentExpression
1. Let list be an empty List.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let spreadObj be GetValue(spreadRef).
4. Let iterator be GetIterator(spreadObj).
5. ReturnIfAbrupt(iterator).
---*/
//- error
Test262Error
//- args
...function*() { throw new Test262Error(); }()

42
src/spread/sngl-iter.case Normal file
View File

@ -0,0 +1,42 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Spread operator applied to the only argument with a valid iterator
template: default
features: [Symbol.iterator]
info: |
12.3.6.1 Runtime Semantics: ArgumentListEvaluation
ArgumentList : ... AssignmentExpression
1. Let list be an empty List.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let spreadObj be GetValue(spreadRef).
4. Let iterator be GetIterator(spreadObj).
5. ReturnIfAbrupt(iterator).
6. Repeat
a. Let next be IteratorStep(iterator).
b. ReturnIfAbrupt(next).
c. If next is false, return list.
d. Let nextArg be IteratorValue(next).
e. ReturnIfAbrupt(nextArg).
f. Append nextArg as the last element of list.
---*/
//- setup
var iter = {};
iter[Symbol.iterator] = function() {
var callCount = 0;
return {
next: function() {
callCount += 1;
return { done: callCount === 3, value: callCount };
}
};
};
//- args
...iter
//- body
assert.sameValue(arguments.length, 2);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);

View File

@ -0,0 +1,69 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/arrow-function.template
/*---
description: SingleNameBinding with normal value iteration (arrow function expression)
es6id: 14.2.16
flags: [generated]
info: >
ArrowFunction : ArrowParameters => ConciseBody
[...]
4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var f;
f = ([x, y, z]) => {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
};
f([1, 2, 3]);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,36 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-expr-throws.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator applied to the only argument when evaluation throws (CallExpression)
es6id: 12.3.4.1
features: [generators]
flags: [generated]
info: >
CallExpression : MemberExpression Arguments
[...]
9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall).
12.3.4.3 Runtime Semantics: EvaluateDirectCall
1. Let argList be ArgumentListEvaluation(arguments).
[...]
6. Let result be Call(func, thisValue, argList).
[...]
12.3.6.1 Runtime Semantics: ArgumentListEvaluation
ArgumentList : ... AssignmentExpression
1. Let list be an empty List.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let spreadObj be GetValue(spreadRef).
4. Let iterator be GetIterator(spreadObj).
5. ReturnIfAbrupt(iterator).
---*/
assert.throws(Test262Error, function() {
(function() {}(...function*() { throw new Test262Error(); }()));
});

View File

@ -0,0 +1,60 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-iter.case
// - src/spread/default/call-expr.template
/*---
description: Spread operator applied to the only argument with a valid iterator (CallExpression)
es6id: 12.3.4.1
features: [Symbol.iterator]
flags: [generated]
info: >
CallExpression : MemberExpression Arguments
[...]
9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall).
12.3.4.3 Runtime Semantics: EvaluateDirectCall
1. Let argList be ArgumentListEvaluation(arguments).
[...]
6. Let result be Call(func, thisValue, argList).
[...]
12.3.6.1 Runtime Semantics: ArgumentListEvaluation
ArgumentList : ... AssignmentExpression
1. Let list be an empty List.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let spreadObj be GetValue(spreadRef).
4. Let iterator be GetIterator(spreadObj).
5. ReturnIfAbrupt(iterator).
6. Repeat
a. Let next be IteratorStep(iterator).
b. ReturnIfAbrupt(next).
c. If next is false, return list.
d. Let nextArg be IteratorValue(next).
e. ReturnIfAbrupt(nextArg).
f. Append nextArg as the last element of list.
---*/
var iter = {};
iter[Symbol.iterator] = function() {
var callCount = 0;
return {
next: function() {
callCount += 1;
return { done: callCount === 3, value: callCount };
}
};
};
var callCount = 0;
(function() {
assert.sameValue(arguments.length, 2);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);
callCount += 1;
}(...iter));
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,94 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/cls-expr-gen-meth.template
/*---
description: SingleNameBinding with normal value iteration (class expression method)
es6id: 14.5.16
flags: [generated]
info: >
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
GeneratorMethod :
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this GeneratorMethod is strict mode code,
let strict be true. Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be GeneratorFunctionCreate(Method,
StrictFormalParameters, GeneratorBody, scope, strict).
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var C = class {
*method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
new C().method([1, 2, 3]).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,94 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/cls-expr-gen-meth-static.template
/*---
description: SingleNameBinding with normal value iteration (static class expression generator method)
es6id: 14.5.16
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var C = class {
static *method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
C.method([1, 2, 3]).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,91 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/cls-expr-meth.template
/*---
description: SingleNameBinding with normal value iteration (class expression method)
es6id: 14.5.16
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var C = class {
method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
new C().method([1, 2, 3]);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,91 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/cls-expr-meth-static.template
/*---
description: SingleNameBinding with normal value iteration (static class expression method)
es6id: 14.5.16
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var C = class {
static method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
C.method([1, 2, 3]);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,70 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/func-expr.template
/*---
description: SingleNameBinding with normal value iteration (function expression)
es6id: 14.1.20
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var f;
f = function([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
};
f([1, 2, 3]);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,70 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/gen-func-expr.template
/*---
description: SingleNameBinding with normal value iteration (generator function expression)
es6id: 14.4.14
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var f;
f = function*([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
};
f([1, 2, 3]).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,35 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-expr-throws.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator applied to the only argument when evaluation throws (`new` operator)
es6id: 12.3.3.1
features: [generators]
flags: [generated]
info: >
MemberExpression : new MemberExpression Arguments
1. Return EvaluateNew(MemberExpression, Arguments).
12.3.3.1.1 Runtime Semantics: EvaluateNew
6. If arguments is empty, let argList be an empty List.
7. Else,
a. Let argList be ArgumentListEvaluation of arguments.
[...]
12.3.6.1 Runtime Semantics: ArgumentListEvaluation
ArgumentList : ... AssignmentExpression
1. Let list be an empty List.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let spreadObj be GetValue(spreadRef).
4. Let iterator be GetIterator(spreadObj).
5. ReturnIfAbrupt(iterator).
---*/
assert.throws(Test262Error, function() {
new function() {}(...function*() { throw new Test262Error(); }());
});

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-iter.case
// - src/spread/default/member-expr.template
/*---
description: Spread operator applied to the only argument with a valid iterator (`new` operator)
es6id: 12.3.3.1
features: [Symbol.iterator]
flags: [generated]
info: >
MemberExpression : new MemberExpression Arguments
1. Return EvaluateNew(MemberExpression, Arguments).
12.3.3.1.1 Runtime Semantics: EvaluateNew
6. If arguments is empty, let argList be an empty List.
7. Else,
a. Let argList be ArgumentListEvaluation of arguments.
[...]
12.3.6.1 Runtime Semantics: ArgumentListEvaluation
ArgumentList : ... AssignmentExpression
1. Let list be an empty List.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let spreadObj be GetValue(spreadRef).
4. Let iterator be GetIterator(spreadObj).
5. ReturnIfAbrupt(iterator).
6. Repeat
a. Let next be IteratorStep(iterator).
b. ReturnIfAbrupt(next).
c. If next is false, return list.
d. Let nextArg be IteratorValue(next).
e. ReturnIfAbrupt(nextArg).
f. Append nextArg as the last element of list.
---*/
var iter = {};
iter[Symbol.iterator] = function() {
var callCount = 0;
return {
next: function() {
callCount += 1;
return { done: callCount === 3, value: callCount };
}
};
};
var callCount = 0;
new function() {
assert.sameValue(arguments.length, 2);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);
callCount += 1;
}(...iter);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,76 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/gen-meth.template
/*---
description: SingleNameBinding with normal value iteration (generator method)
es6id: 14.4.13
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var obj = {
*method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
obj.method([1, 2, 3]).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,73 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/meth.template
/*---
description: SingleNameBinding with normal value iteration (method)
es6id: 14.3.8
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var obj = {
method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
obj.method([1, 2, 3]);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,43 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-expr-throws.case
// - src/spread/error/super-call.template
/*---
description: Spread operator applied to the only argument when evaluation throws (SuperCall)
es6id: 12.3.5.1
features: [generators]
flags: [generated]
info: >
SuperCall : super Arguments
1. Let newTarget be GetNewTarget().
2. If newTarget is undefined, throw a ReferenceError exception.
3. Let func be GetSuperConstructor().
4. ReturnIfAbrupt(func).
5. Let argList be ArgumentListEvaluation of Arguments.
[...]
12.3.6.1 Runtime Semantics: ArgumentListEvaluation
ArgumentList : ... AssignmentExpression
1. Let list be an empty List.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let spreadObj be GetValue(spreadRef).
4. Let iterator be GetIterator(spreadObj).
5. ReturnIfAbrupt(iterator).
---*/
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(...function*() { throw new Test262Error(); }());
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-iter.case
// - src/spread/default/super-call.template
/*---
description: Spread operator applied to the only argument with a valid iterator (SuperCall)
es6id: 12.3.5.1
features: [Symbol.iterator]
flags: [generated]
info: >
SuperCall : super Arguments
1. Let newTarget be GetNewTarget().
2. If newTarget is undefined, throw a ReferenceError exception.
3. Let func be GetSuperConstructor().
4. ReturnIfAbrupt(func).
5. Let argList be ArgumentListEvaluation of Arguments.
[...]
12.3.6.1 Runtime Semantics: ArgumentListEvaluation
ArgumentList : ... AssignmentExpression
1. Let list be an empty List.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let spreadObj be GetValue(spreadRef).
4. Let iterator be GetIterator(spreadObj).
5. ReturnIfAbrupt(iterator).
6. Repeat
a. Let next be IteratorStep(iterator).
b. ReturnIfAbrupt(next).
c. If next is false, return list.
d. Let nextArg be IteratorValue(next).
e. ReturnIfAbrupt(nextArg).
f. Append nextArg as the last element of list.
---*/
var iter = {};
iter[Symbol.iterator] = function() {
var callCount = 0;
return {
next: function() {
callCount += 1;
return { done: callCount === 3, value: callCount };
}
};
};
var callCount = 0;
class Test262ParentClass {
constructor() {
assert.sameValue(arguments.length, 2);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);
callCount += 1;
}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(...iter);
}
}
new Test262ChildClass();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,92 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/cls-decl-gen-meth.template
/*---
description: SingleNameBinding with normal value iteration (class expression method)
es6id: 14.5.16
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
class C {
*method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
new C().method([1, 2, 3]).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,92 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/cls-decl-gen-meth-static.template
/*---
description: SingleNameBinding with normal value iteration (static class expression generator method)
es6id: 14.5.15
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
class C {
static *method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
C.method([1, 2, 3]).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,90 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/cls-decl-meth.template
/*---
description: SingleNameBinding with normal value iteration (class expression method)
es6id: 14.5.15
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
class C {
method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
new C().method([1, 2, 3]);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,90 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/cls-decl-meth-static.template
/*---
description: SingleNameBinding with normal value iteration (static class expression method)
es6id: 14.5.15
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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
class C {
static method([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
}
};
C.method([1, 2, 3]);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,43 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/const-stmt.template
/*---
description: SingleNameBinding with normal value iteration (`const` statement)
es6id: 13.3.1.4
flags: [generated]
info: >
LexicalBinding : BindingPattern Initializer
1. Let rhs be the result of evaluating Initializer.
2. Let value be GetValue(rhs).
3. ReturnIfAbrupt(value).
4. Let env be the running execution context's LexicalEnvironment.
5. Return the result of performing BindingInitialization for BindingPattern
using value and env as the arguments.
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
const [x, y, z] = [1, 2, 3];
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);

View File

@ -0,0 +1,69 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/func-decl.template
/*---
description: SingleNameBinding with normal value iteration (function declaration)
es6id: 14.1.19
flags: [generated]
info: >
FunctionDeclaration :
function BindingIdentifier ( FormalParameters ) { FunctionBody }
[...]
3. Let F 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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
function f([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
};
f([1, 2, 3]);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,68 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/gen-func-decl.template
/*---
description: SingleNameBinding with normal value iteration (generator function declaration)
es6id: 14.4.12
flags: [generated]
info: >
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
[...]
2. Let F 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.
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
function* f([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
};
f([1, 2, 3]).next();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,43 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/let-stmt.template
/*---
description: SingleNameBinding with normal value iteration (`let` statement)
es6id: 13.3.1.4
flags: [generated]
info: >
LexicalBinding : BindingPattern Initializer
1. Let rhs be the result of evaluating Initializer.
2. Let value be GetValue(rhs).
3. ReturnIfAbrupt(value).
4. Let env be the running execution context's LexicalEnvironment.
5. Return the result of performing BindingInitialization for BindingPattern
using value and env as the arguments.
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
let [x, y, z] = [1, 2, 3];
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/var-stmt.template
/*---
description: SingleNameBinding with normal value iteration (`var` statement)
es6id: 13.3.2.4
flags: [generated]
info: >
VariableDeclaration : BindingPattern Initializer
1. Let rhs be the result of evaluating Initializer.
2. Let rval be GetValue(rhs).
3. ReturnIfAbrupt(rval).
4. Return the result of performing BindingInitialization for
BindingPattern passing rval and undefined as arguments.
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var [x, y, z] = [1, 2, 3];
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);