for-await-of: dstr-assignment, cases

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
This commit is contained in:
Rick Waldron 2017-05-16 16:34:06 -04:00
parent 9f3b85fb21
commit d4fde0a5c3
179 changed files with 3974 additions and 484 deletions

View File

@ -9,7 +9,7 @@ template: default
---*/
//- setup
var v2, vNull, vHole, vUndefined, vOob;
let v2, vNull, vHole, vUndefined, vOob;
//- elems
[v2 = 10, vNull = 11, vHole = 12, vUndefined = 13, vOob = 14]
//- vals

View File

@ -8,8 +8,8 @@ template: default
---*/
//- setup
var flag1 = false, flag2 = false;
var _;
let flag1 = false, flag2 = false;
let _;
//- elems
[ _ = flag1 = true, _ = flag2 = true ]
//- vals

View File

@ -11,15 +11,13 @@ info: >
7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
a. Let hasNameProperty be ? HasOwnProperty(v, "name").
b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
includes: [propertyHelper.js]
---*/
//- setup
var arrow;
let arrow;
//- elems
[ arrow = () => {} ]
//- vals

View File

@ -11,16 +11,14 @@ info: >
7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
a. Let hasNameProperty be ? HasOwnProperty(v, "name").
b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
includes: [propertyHelper.js]
features: [class]
---*/
//- setup
var xCls, cls, xCls2;
let xCls, cls, xCls2;
//- elems
[ xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } ]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -12,15 +12,13 @@ info: >
7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
a. Let hasNameProperty be ? HasOwnProperty(v, "name").
b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
includes: [propertyHelper.js]
---*/
//- setup
var xCover, cover;
let xCover, cover;
//- elems
[ xCover = (0, function() {}), cover = (function() {}) ]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,27 +11,25 @@ info: >
7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
a. Let hasNameProperty be ? HasOwnProperty(v, "name").
b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
includes: [propertyHelper.js]
features: [class]
---*/
//- setup
var xFn, fn;
let xFnexp, fnexp;
//- elems
[ xFn = function x() {}, fn = function() {} ]
[ xFnexp = function x() {}, fnexp = function() {} ]
//- vals
[]
//- body
assert(xFn.name !== 'xFn');
assert(xFnexp.name !== 'xFnexp');
assert.sameValue(fn.name, 'fn');
verifyNotEnumerable(fn, 'name');
verifyNotWritable(fn, 'name');
verifyConfigurable(fn, 'name');
assert.sameValue(fnexp.name, 'fnexp');
verifyNotEnumerable(fnexp, 'name');
verifyNotWritable(fnexp, 'name');
verifyConfigurable(fnexp, 'name');
//- teardown
promise

View File

@ -11,16 +11,14 @@ info: >
7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
a. Let hasNameProperty be ? HasOwnProperty(v, "name").
b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
includes: [propertyHelper.js]
features: [generators]
---*/
//- setup
var xGen, gen;
let xGen, gen;
//- elems
[ xGen = function* x() {}, gen = function*() {} ]
//- vals

View File

@ -8,7 +8,7 @@ template: default
---*/
//- setup
var x;
let x;
//- elems
[ x = 'x' in {} ]
//- vals

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
Value retrieval of Initializer obeys `let` semantics.
template: default
es6id: 12.14.5.3
features: [let]
---*/
//- setup
let x;
//- elems
[ x = y ]
//- vals
[]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(constructor, ReferenceError);
}).then($DONE, $DONE);
let y;

View File

@ -8,8 +8,8 @@ template: default
---*/
//- setup
var x = 0;
var a, b;
let x = 0;
let a, b;
//- elems
[ a = x += 1, b = x *= 2 ]
//- vals

View File

@ -11,7 +11,7 @@ flags: [noStrict]
---*/
//- setup
var argument, eval;
let argument, eval;
//- elems
[arguments = 4, eval = 5]
//- vals

View File

@ -0,0 +1,32 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When a `yield` token appears within the Initializer of an
AssignmentElement within a generator function body, it behaves as a
YieldExpression.
template: async-generator
es6id: 12.14.5.4
features: [generators]
---*/
//- setup
let value = [];
let x;
//- elems
[ x = yield ]
//- vals
[]
//- teardown
iter.next().then(result => {
assert.sameValue(result.value, undefined);
assert.sameValue(result.done, false);
assert.sameValue(x, undefined);
iter.next(4).then(result => {
assert.sameValue(result.value, undefined);
assert.sameValue(result.done, true);
assert.sameValue(x, 4);
}, $DONE).then($DONE, $DONE);
}, $DONE).catch($DONE);

View File

@ -0,0 +1,19 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When a `yield` token appears within the Initializer of an AssignmentElement
outside of a generator function body, it behaves as an IdentifierReference.
template: error-async-function-syntax
es6id: 12.14.5.4
flags: [onlyStrict]
negative:
phase: early
type: SyntaxError
---*/
//- elems
[ x = yield ]
//- vals
[]

View File

@ -0,0 +1,26 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When a `yield` token appears within the Initializer of an AssignmentElement
outside of a generator function body, it behaves as an IdentifierReference.
template: async-function
es6id: 12.14.5.4
flags: [noStrict]
---*/
//- setup
let yield = 4;
let x;
//- elems
[ x = yield ]
//- vals
[]
//- body
assert.sameValue(x, 4);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,32 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Abrupt completion returned from GetIterator
info: |
ArrayAssignmentPattern : [ AssignmentElementList ]
1. Let iterator be ? GetIterator(value).
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let iterable = {
[Symbol.iterator]() {
throw new Test262Error();
}
};
let _;
//- elems
[ _ ]
//- vals
iterable
//- teardown
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);

View File

@ -0,0 +1,47 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Abrupt completion returned from IteratorClose
info: |
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let nextCount = 0;
let returnCount = 0;
let _;
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return() {
returnCount += 1;
throw new Test262Error();
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ _ ]
//- vals
iterable
//- teardown
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 1);
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);

View File

@ -0,0 +1,55 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose throws a TypeError when `return` returns a non-Object value
info: |
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
5. Return result.
7.4.6 IteratorClose( iterator, completion )
[...]
5. Let innerResult be Call(return, iterator, « »).
6. If completion.[[Type]] is throw, return Completion(completion).
7. If innerResult.[[Type]] is throw, return Completion(innerResult).
8. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception.
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let _;
let nextCount = 0;
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return() {
return null;
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ _ ]
//- vals
iterable
//- teardown
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(nextCount, 1);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -8,30 +8,31 @@ info: |
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, result).
6. Return result.
4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
5. Return result.
features: [Symbol.iterator]
template: default
template: async-generator
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var _;
var iterable = {};
var iterator = {
next: function() {
let nextCount = 0;
let returnCount = 0;
let _;
let iterator = {
next() {
nextCount += 1;
return { done: true };
},
return: function() {
return() {
returnCount += 1;
return {};
}
};
iterable[Symbol.iterator] = function() {
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ _ ]
@ -42,6 +43,6 @@ assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 0);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
iter.next().then(() => {
assert.sameValue(iterCount, 1);
}).then($DONE, $DONE);

View File

@ -8,14 +8,13 @@ info: |
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
6. Return result.
4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
5. Return result.
7.4.6 IteratorClose( iterator, completion )
7.4.6 IteratorClose ( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
5. Let innerResult be Call(return, iterator, « »).
[...]
features: [Symbol.iterator]
template: default
@ -23,20 +22,20 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var thisValue = null;
var args = null;
var _;
var iterable = {};
var iterator = {
next: function() {
let nextCount = 0;
let returnCount = 0;
let thisValue = null;
let args = null;
let _;
let iterable = {};
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return: function() {
return() {
returnCount += 1;
thisValue = this;
args = arguments;

View File

@ -0,0 +1,49 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose throws a TypeError when `return` returns a non-Object value
info: |
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
5. Return result.
7.4.6 IteratorClose( iterator, completion )
[...]
5. Let innerResult be Call(return, iterator, « »).
6. If completion.[[Type]] is throw, return Completion(completion).
7. If innerResult.[[Type]] is throw, return Completion(innerResult).
8. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception.
features: [Symbol.iterator, generators]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let unreachable = 0;
let iterator = {
return() {
return null;
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ {}[yield] ]
//- vals
iterable
//- body
unreachable += 1;
//- teardown
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(unreachable, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -0,0 +1,46 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose is not called when iteration produces an abrupt completion
info: |
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
5. Return result.
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let nextCount = 0;
let returnCount = 0;
let iterator = {
next() {
nextCount += 1;
throw new Test262Error();
},
return() {
returnCount += 1;
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
let _;
//- elems
[ x ]
//- vals
iterable
//- teardown
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 0);
}).then($DONE, $DONE);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral
or an ArrayLiteral and if the lexical token sequence matched by
LeftHandSideExpression cannot be parsed with no tokens left over using
AssignmentPattern as the goal symbol.
template: error-async-function-syntax
es6id: 12.14.5.1
negative:
phase: early
type: SyntaxError
---*/
//- elems
[[(x, y)]]
//- vals
[[]]

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When DestructuringAssignmentTarget is an array literal and the value is
`null`, a TypeError should be thrown.
template: default
es6id: 12.14.5.3
---*/
//- setup
let _;
//- elems
[[ _ ]]
//- vals
[null]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When DestructuringAssignmentTarget is an array literal and the value is a
"hole", a TypeError should be thrown.
template: default
es6id: 12.14.5.3
---*/
//- setup
let _;
//- elems
[[ _ ]]
//- vals
[ , ]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When DestructuringAssignmentTarget is an array literal and the value is
`undefined`, a TypeError should be thrown.
template: default
es6id: 12.14.5.3
---*/
//- setup
let _;
//- elems
[[ x ]]
//- vals
[undefined]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When DestructuringAssignmentTarget is an array literal and no value is
defined, a TypeError should be thrown.
template: default
es6id: 12.14.5.3
---*/
//- setup
let _;
//- elems
[[ x ]]
//- vals
[]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -0,0 +1,33 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When a `yield` token appears within the DestructuringAssignmentTarget of a
nested destructuring assignment and within a generator function body, it
behaves as a YieldExpression.
template: async-generator
es6id: 12.14.5.3
features: [generators]
---*/
//- setup
let value = [[22]];
let x = {};
//- elems
[[x[yield]]]
//- vals
value
//- teardown
iter.next().then(result => {
assert.sameValue(result.value, undefined);
assert.sameValue(result.done, false);
assert.sameValue(x.prop, undefined);
iter.next('prop').then(result => {
assert.sameValue(result.value, undefined);
assert.sameValue(result.done, true);
assert.sameValue(x.prop, 22);
}, $DONE).then($DONE, $DONE);
}, $DONE).catch($DONE);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When a `yield` token appears within the DestructuringAssignmentTarget of a
nested destructuring assignment outside of strict mode, it behaves as an
IdentifierReference.
template: error-async-function-syntax
es6id: 12.14.5.3
flags: [onlyStrict]
negative:
phase: early
type: SyntaxError
---*/
//- elems
[[x[yield]]]
//- vals
[[]]

View File

@ -6,16 +6,20 @@ desc: >
When a `yield` token appears within the DestructuringAssignmentTarget of a
nested destructuring assignment outside of strict mode, it behaves as an
IdentifierReference.
template: default
template: async-function
flags: [noStrict]
---*/
//- setup
var yield = 'prop';
var x = {};
let yield = 'prop';
let x = {};
//- elems
[[x[yield]]]
//- vals
[[22]]
//- body
assert.sameValue(x.prop, 22);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -6,14 +6,18 @@ desc: >
When DestructuringAssignmentTarget is an array literal, it should be parsed
parsed as a DestructuringAssignmentPattern and evaluated as a destructuring
assignment.
template: default
template: async-function
---*/
//- setup
var x;
let x;
//- elems
[[x]]
//- vals
[[1]]
//- body
assert.sameValue(x, 1);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral
or an ArrayLiteral and if the lexical token sequence matched by
LeftHandSideExpression cannot be parsed with no tokens left over using
AssignmentPattern as the goal symbol.
template: error-async-function-syntax
es6id: 12.14.5.1
negative:
phase: early
type: SyntaxError
---*/
//- elems
[{ get x() {} }]
//- vals
[{}]

View File

@ -0,0 +1,22 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When DestructuringAssignmentTarget is an object literal and the value is
`null`, a TypeError should be thrown.
template: default
es6id: 12.14.5.3
---*/
//- setup
let x;
//- elems
[{ x }]
//- vals
[null]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When DestructuringAssignmentTarget is an object literal and the value is a
"hole", a TypeError should be thrown.
template: default
es6id: 12.14.5.3
---*/
//- setup
let x;
//- elems
[{ x }]
//- vals
[ , ]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When DestructuringAssignmentTarget is an object literal and the value is
`undefined`, a TypeError should be thrown.
template: default
es6id: 12.14.5.3
---*/
//- setup
let x;
//- elems
[{ x }]
//- vals
[undefined]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When DestructuringAssignmentTarget is an object literal and no value is
defined, a TypeError should be thrown.
template: default
es6id: 12.14.5.3
---*/
//- setup
let x;
//- elems
[{ x }]
//- vals
[]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -10,7 +10,7 @@ template: async-generator
---*/
//- setup
var x;
let x;
//- elems
@ -18,14 +18,14 @@ var x;
//- vals
[{}]
//- teardown
iter.next().then(iterationResult => {
assert.sameValue(iterationResult.value, undefined);
assert.sameValue(iterationResult.done, false);
iter.next().then(result => {
assert.sameValue(result.value, undefined);
assert.sameValue(result.done, false);
assert.sameValue(x, undefined);
iter.next(4).then(iterationResult => {
assert.sameValue(iterationResult.value, undefined);
assert.sameValue(iterationResult.done, true);
iter.next(4).then(result => {
assert.sameValue(result.value, undefined);
assert.sameValue(result.done, true);
assert.sameValue(x, 4);
}, $DONE).then($DONE, $DONE);
}, $DONE).catch($DONE);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When a `yield` token appears within the Initializer of a nested
destructuring assignment outside of a generator function body, it behaves
as a IdentifierReference.
template: error-async-function-syntax
es6id: 12.14.5.3
flags: [onlyStrict]
negative:
phase: early
type: SyntaxError
---*/
//- elems
[{ x = yield }]
//- vals
[{}]

View File

@ -11,8 +11,8 @@ flags: [noStrict]
---*/
//- setup
var yield = 2;
var x;
let yield = 2;
let x;
//- elems
[{ x = yield }]
//- vals

View File

@ -10,7 +10,7 @@ template: default
---*/
//- setup
var x;
let x;
//- elems
[{ x }]
//- vals

View File

@ -0,0 +1,17 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
The assignment target should obey `const` semantics.
template: default
es6id: 12.14.5.3
features: [const]
---*/
//- setup
const c = null;
//- elems
[ c ]
//- vals
[1]

View File

@ -0,0 +1,22 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
The assignment target should obey `let` semantics.
template: default
es6id: 12.14.5.3
features: [let]
---*/
//- elems
[ x ]
//- vals
[]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, ReferenceError);
}).then($DONE, $DONE);
let x;

View File

@ -9,7 +9,7 @@ template: default
---*/
//- setup
var x, setValue;
let x, setValue;
x = {
get y() {
$ERROR('The property should not be accessed.');

View File

@ -0,0 +1,27 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
Any error raised as a result of setting the value should be forwarded to
the runtime.
template: default
es6id: 12.14.5.3
---*/
//- setup
let x = {
set y(val) {
throw new Test262Error();
}
};
//- elems
[x.y]
//- vals
[23]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);

View File

@ -9,7 +9,7 @@ template: default
---*/
//- setup
var x = {};
let x = {};
//- elems
[x.y]
//- vals

View File

@ -0,0 +1,22 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
In strict mode, if the the assignment target is an unresolvable reference,
a ReferenceError should be thrown.
template: default
es6id: 12.14.5.3
flags: [onlyStrict]
---*/
//- elems
[ unresolvable ]
//- vals
[]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, ReferenceError);
}).then($DONE, $DONE);

View File

@ -10,7 +10,7 @@ template: async-function
---*/
//- setup
var x, y, z;
let x, y, z;
//- elems
[x, y, z]
//- vals

View File

@ -11,7 +11,7 @@ flags: [noStrict]
---*/
//- setup
var argument, eval;
let argument, eval;
//- elems
[arguments, eval]
//- vals

View File

@ -0,0 +1,21 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
It is a Syntax Error if LeftHandSideExpression is neither an
ObjectLiteral nor an ArrayLiteral and
IsValidSimpleAssignmentTarget(LeftHandSideExpression) is
false.
template: error-async-function-syntax
es6id: 12.14.5.1
flags: [onlyStrict]
negative:
phase: early
type: SyntaxError
---*/
//- elems
[arguments]
//- vals
[]

View File

@ -11,9 +11,9 @@ features: [generators]
---*/
//- setup
var value = [33];
var x = {};
var iterationResult;
let value = [33];
let x = {};
let iterationResult;
//- elems
[ x[yield] ]
@ -27,8 +27,6 @@ iter.next().then(iterationResult => {
assert.sameValue(iterationResult.done, false);
assert.sameValue(x.prop, undefined);
// TODO add iterCount
//
iter.next('prop').then(iterationResult => {
assert.sameValue(iterationResult.value, undefined);
assert.sameValue(iterationResult.done, true);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
When a `yield` token appears within the DestructuringAssignmentTarget of an
AssignmentElement and outside of a generator function body, it behaves as
an IdentifierReference.
template: error-async-function-syntax
es6id: 12.14.5.4
flags: [onlyStrict]
negative:
phase: early
type: SyntaxError
---*/
//- elems
[ x[yield] ]
//- vals
[]

View File

@ -11,8 +11,8 @@ flags: [noStrict]
---*/
//- setup
var yield = 'prop';
var x = {};
let yield = 'prop';
let x = {};
//- elems
[ x[yield] ]
//- vals

View File

@ -0,0 +1,63 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Abrupt completion returned during evaluation of elision
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
6. If Elision is present, then
a. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of Elision with
iteratorRecord as the argument.
b. If status is an abrupt completion, then
i. If iteratorRecord.[[done]] is false, return
IteratorClose(iterator, status).
ii. Return Completion(status).
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let nextCount = 0;
let returnCount = 0;
let x;
let iterator = {
next() {
nextCount += 1;
if (nextCount === 2) {
throw new Test262Error();
}
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return() {
returnCount += 1;
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ x , , ]
//- vals
iterable
//- teardown
iter.next().then(() => {
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(nextCount, 2);
assert.sameValue(returnCount, 0);
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);
}, $DONE);

View File

@ -0,0 +1,60 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Abrupt completion returned from IteratorClose
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
6. If Elision is present, then
a. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of Elision with
iteratorRecord as the argument.
b. If status is an abrupt completion, then
[...]
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
status).
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let nextCount = 0;
let returnCount = 0;
let x;
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return() {
returnCount += 1;
throw new Test262Error();
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ x , , ]
//- vals
iterable
//- teardown
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(nextCount, 2);
assert.sameValue(returnCount, 1);
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);

View File

@ -0,0 +1,59 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose throws a TypeError when `return` returns a non-Object value
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
6. If Elision is present, then
a. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of Elision with
iteratorRecord as the argument.
b. If status is an abrupt completion, then
[...]
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
status).
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
7. If completion.[[type]] is throw, return Completion(completion).
8. If innerResult.[[type]] is throw, return Completion(innerResult).
9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
exception.
features: [Symbol.iterator]
template: default
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let x;
let nextCount = 0;
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return() {
return null;
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- error
TypeError
//- elems
[ x , , ]
//- vals
iterable

View File

@ -1,4 +1,4 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: IteratorClose not invoked when elision exhausts the iterator
@ -7,13 +7,15 @@ info: |
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
6. If Elision is present, then
5. If Elision is present, then
a. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of Elision with
iteratorRecord as the argument.
b. If status is an abrupt completion, then
[...]
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
7. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
status).
9. Return Completion(status).
features: [Symbol.iterator]
@ -22,10 +24,10 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var x;
var iterator = {
let nextCount = 0;
let returnCount = 0;
let x;
let iterator = {
next() {
nextCount += 1;
@ -35,7 +37,7 @@ var iterator = {
returnCount += 1;
}
};
var iterable = {
let iterable = {
[Symbol.iterator]() {
return iterator;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: IteratorClose invoked when elision does not exhaust the iterator
@ -7,19 +7,21 @@ info: |
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
6. If Elision is present, then
5. If Elision is present, then
a. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of Elision with
iteratorRecord as the argument.
b. If status is an abrupt completion, then
[...]
8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
7. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
status).
7.4.6 IteratorClose( iterator, completion )
7.4.6 IteratorClose ( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
5. Let innerResult be Call(return, iterator, « »).
[...]
features: [Symbol.iterator]
template: async-generator
@ -27,12 +29,12 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var thisValue = null;
var args = null;
var x;
var iterator = {
let nextCount = 0;
let returnCount = 0;
let thisValue = null;
let args = null;
let x;
let iterator = {
next() {
nextCount += 1;
@ -47,7 +49,7 @@ var iterator = {
return {};
}
};
var iterable = {
let iterable = {
[Symbol.iterator]() {
return iterator;
}

View File

@ -0,0 +1,33 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Abrupt completion returned from GetIterator
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
1. Let iterator be GetIterator(value).
2. ReturnIfAbrupt(iterator).
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let iterable = {
[Symbol.iterator]() {
throw new Test262Error();
}
};
let x;
//- elems
[ x , ]
//- vals
iterable
//- teardown
iter.return().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);

View File

@ -0,0 +1,59 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Abrupt completion returned from IteratorClose
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
2. Let iteratorRecord be Record {[[Iterator]]: iterator, [[Done]]: false}.
3. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
iteratorRecord as the argument.
4. If status is an abrupt completion, then
a. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
b. Return Completion(status).
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let nextCount = 0;
let returnCount = 0;
let thrower = function() {
throw new Test262Error();
};
let x;
let iterator = {
next() {
nextCount += 1;
return { done: nextCount > 10 };
},
return() {
returnCount += 1;
throw new Test262Error();
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- error
Test262Error
//- elems
[ x , ]
//- vals
iterable
//- teardown
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 1);
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);

View File

@ -0,0 +1,65 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose throws a TypeError when `return` returns a non-Object value
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
2. Let iteratorRecord be Record {[[Iterator]]: iterator, [[Done]]: false}.
3. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
iteratorRecord as the argument.
4. If status is an abrupt completion, then
a. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
b. Return Completion(status).
7.4.6 IteratorClose( iterator, completion )
[...]
5. Let innerResult be Call(return, iterator, « »).
6. If completion.[[type]] is throw, return Completion(completion).
7. If innerResult.[[type]] is throw, return Completion(innerResult).
8. If Type(innerResult.[[value]]) is not Object, throw a TypeError
exception.
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let x;
let nextCount = 0;
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return() {
return null;
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- error
TypeError
//- elems
[ x , ]
//- vals
iterable
//- teardown
iter.return().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
@ -9,11 +9,11 @@ info: |
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
4. Let status be the result of performing
2. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
3. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
iteratorRecord as the argument.
5. If status is an abrupt completion, then
4. If status is an abrupt completion, then
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
status).
b. Return Completion(status).
@ -23,13 +23,13 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var thrower = function() {
let nextCount = 0;
let returnCount = 0;
let thrower = function() {
throw new Test262Error();
};
var x;
var iterator = {
let x;
let iterator = {
next() {
nextCount += 1;
return { done: true };
@ -38,7 +38,7 @@ var iterator = {
returnCount += 1;
}
};
var iterable = {
let iterable = {
[Symbol.iterator]() {
return iterator;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
@ -9,19 +9,19 @@ info: |
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
4. Let status be the result of performing
2. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
3. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
iteratorRecord as the argument.
5. If status is an abrupt completion, then
4. If status is an abrupt completion, then
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
status).
b. Return Completion(status).
7.4.6 IteratorClose( iterator, completion )
7.4.6 IteratorClose ( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
5. Let innerResult be Call(return, iterator, « »).
[...]
features: [Symbol.iterator]
template: async-generator
@ -29,12 +29,12 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var thisValue = null;
var args = null;
var x;
var iterator = {
let nextCount = 0;
let returnCount = 0;
let thisValue = null;
let args = null;
let x;
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
@ -48,7 +48,7 @@ var iterator = {
return {};
}
};
var iterable = {
let iterable = {
[Symbol.iterator]() {
return iterator;
}

View File

@ -0,0 +1,60 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose is invoked when evaluation of AssignmentElementList returns
a "return" completion and the iterator has not been marked as "done"
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
2. Let iteratorRecord be Record {[[Iterator]]: iterator, [[Done]]: false}.
3. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
iteratorRecord as the argument.
4. If status is an abrupt completion, then
a. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
b. Return Completion(status).
7.4.6 IteratorClose( iterator, completion )
[...]
5. Let innerResult be Call(return, iterator, « »).
6. If completion.[[type]] is throw, return Completion(completion).
7. If innerResult.[[type]] is throw, return Completion(innerResult).
features: [Symbol.iterator, generators]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let returnCount = 0;
let unreachable = 0;
let iterator = {
return() {
returnCount += 1;
throw new Test262Error();
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ {}[yield] , ]
//- vals
iterable
//- body
unreachable += 1;
//- teardown
iter.return().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(returnCount, 1);
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);

View File

@ -0,0 +1,55 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose throws a TypeError when `return` returns a non-Object value
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
2. Let iteratorRecord be Record {[[Iterator]]: iterator, [[Done]]: false}.
3. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
iteratorRecord as the argument.
4. If status is an abrupt completion, then
a. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
b. Return Completion(status).
7.4.6 IteratorClose( iterator, completion )
[...]
5. Let innerResult be Call(return, iterator, « »).
6. If completion.[[type]] is throw, return Completion(completion).
7. If innerResult.[[type]] is throw, return Completion(innerResult).
8. If Type(innerResult.[[value]]) is not Object, throw a TypeError
exception.
features: [Symbol.iterator, generators]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let iterator = {
return() {
return null;
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ {}[yield] , ]
//- vals
iterable
//- teardown
iter.return().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -0,0 +1,68 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose is invoked when evaluation of AssignmentElementList returns
a "return" completion and the iterator has not been marked as "done"
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
2. Let iteratorRecord be Record {[[Iterator]]: iterator, [[Done]]: false}.
3. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
iteratorRecord as the argument.
4. If status is an abrupt completion, then
a. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
b. Return Completion(status).
7.4.6 IteratorClose( iterator, completion )
[...]
5. Let innerResult be Call(return, iterator, « »).
6. If completion.[[type]] is throw, return Completion(completion).
7. If innerResult.[[type]] is throw, return Completion(innerResult).
features: [Symbol.iterator, generators]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let returnCount = 0;
let unreachable = 0;
let thisValue = null;
let args = null;
let iterator = {
return() {
returnCount += 1;
thisValue = this;
args = arguments;
return {};
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ {}[yield] , ]
//- vals
iterable
//- body
unreachable += 1;
//- teardown
iter.return(888).then(result => {
assert.sameValue(returnCount, 1);
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
assert.sameValue(result.value, 888);
assert(result.done, 'Iterator correctly closed');
assert.sameValue(thisValue, iterator, 'correct `this` value');
assert(!!args, 'arguments object provided');
assert.sameValue(args.length, 0, 'zero arguments specified');
}).then($DONE, $DONE);

View File

@ -0,0 +1,58 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose is not invoked when evaluation of AssignmentElementList
returns an abrupt completion and the iterator has been marked as "done"
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
4. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
iteratorRecord as the argument.
5. If status is an abrupt completion, then
a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
status).
b. Return Completion(status).
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let nextCount = 0;
let returnCount = 0;
let iterable = {};
let thrower = function() {
throw new Test262Error();
};
let iterator = {
next() {
nextCount += 1;
throw new Test262Error();
},
return() {
returnCount += 1;
}
};
iterable[Symbol.iterator] = function() {
return iterator;
};
let x;
//- error
Test262Error
//- elems
[ x , ]
//- vals
iterable
//- teardown
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 0);
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);

View File

@ -0,0 +1,55 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose is not called when rest element evaluation has exhausted the
iterator
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
6. If AssignmentRestElement is present, then
a. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
with iteratorRecord as the argument.
7. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
8. Return Completion(status).
features: [Symbol.iterator]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let nextCount = 0;
let returnCount = 0;
let x, y;
let iterator = {
next() {
nextCount += 1;
return { value: nextCount, done: nextCount > 1 };
},
return() {
returnCount += 1;
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ x , ...y ]
//- vals
iterable
//- teardown
iter.next().then(() => {
iter.return().then(() => {
assert.sameValue(nextCount, 2, 'nextCount');
assert.sameValue(returnCount, 0, 'returnCount');
assert.sameValue(x, 1, 'x');
assert.sameValue(y.length, 0, 'y.length');
}).then($DONE, $DONE);
}).then($DONE, $DONE);

View File

@ -0,0 +1,69 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose is called when AssignmentRestEvaluation produces a "return"
completion due to reference evaluation
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
6. If AssignmentRestElement is present, then
a. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
with iteratorRecord as the argument.
7. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
8. Return Completion(status).
7.4.6 IteratorClose ( iterator, completion )
[...]
5. Let innerResult be Call(return, iterator, « »).
6. If completion.[[type]] is throw, return Completion(completion).
7. If innerResult.[[type]] is throw, return Completion(innerResult).
features: [Symbol.iterator, generators]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let nextCount = 0;
let returnCount = 0;
let unreachable = 0;
let x;
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return() {
returnCount += 1;
throw new Test262Error();
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ x , ...{}[yield] ]
//- vals
iterable
//- body
unreachable += 1;
//- teardown
iter.next().then(() => {
iter.return().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 1);
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);
}).then($DONE, $DONE);

View File

@ -0,0 +1,60 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose throws a TypeError when `return` returns a non-Object value
info: |
ArrayAssignmentPattern :
[ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
[...]
6. If AssignmentRestElement is present, then
a. Let status be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
with iteratorRecord as the argument.
7. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
8. Return Completion(status).
7.4.6 IteratorClose ( iterator, completion )
[...]
5. Let innerResult be Call(return, iterator, « »).
6. If completion.[[type]] is throw, return Completion(completion).
7. If innerResult.[[type]] is throw, return Completion(innerResult).
features: [Symbol.iterator, generators]
template: async-generator
es6id: 12.14.5.2
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
let nextCount = 0;
let x;
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return() {
return null;
}
};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[ x , ...{}[yield] ]
//- vals
iterable
//- teardown
iter.return().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(nextCount, 1);
assert.sameValue(constructor, Test262Error);
}).then($DONE, $DONE);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
@ -6,10 +6,11 @@ desc: >
info: |
ArrayAssignmentPattern : [ Elision ]
1. Let iterator be GetIterator(value).
1. Let iterator be ? GetIterator(value).
[...]
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result)..
[...]
features: [Symbol.iterator]
template: async-generator
@ -17,9 +18,9 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var iterator = {
let nextCount = 0;
let returnCount = 0;
let iterator = {
next() {
nextCount += 1;
return { done: true };
@ -29,7 +30,7 @@ var iterator = {
return {};
}
};
var iterable = {
let iterable = {
[Symbol.iterator]() {
return iterator;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
@ -7,16 +7,17 @@ desc: >
info: |
ArrayAssignmentPattern : [ Elision ]
1. Let iterator be GetIterator(value).
[...]
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
[...]
7.4.6 IteratorClose( iterator, completion )
1. Let iterator be ? GetIterator(value).
[...]
6. Let innerResult be Call(return, iterator, « »).
4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result)..
[...]
7.4.6 IteratorClose ( iterator, completion )
[...]
5. Let innerResult be Call(return, iterator, « »).
[...]
features: [Symbol.iterator]
template: async-generator
@ -24,11 +25,11 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var thisValue = null;
var args = null;
var iterator = {
let nextCount = 0;
let returnCount = 0;
let thisValue = null;
let args = null;
let iterator = {
next() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
@ -42,7 +43,7 @@ var iterator = {
return {};
}
};
var iterable = {
let iterable = {
[Symbol.iterator]() {
return iterator;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >

View File

@ -1,4 +1,4 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Iterator is closed without iterating
@ -9,10 +9,10 @@ info: |
2. ReturnIfAbrupt(iterator).
3. Return IteratorClose(iterator, NormalCompletion(empty)).
7.4.6 IteratorClose( iterator, completion )
7.4.6 IteratorClose ( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
5. Let innerResult be Call(return, iterator, « »).
[...]
features: [Symbol.iterator]
template: async-generator
@ -20,11 +20,11 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var thisValue = null;
var args = null;
var iterator = {
let nextCount = 0;
let returnCount = 0;
let thisValue = null;
let args = null;
let iterator = {
next() {
nextCount += 1;
return { done: true };
@ -36,7 +36,7 @@ var iterator = {
return {};
}
};
var iterable = {
let iterable = {
[Symbol.iterator]() {
return iterator;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -10,7 +10,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x, y;
let x, y;
//- elems
[x, ...y]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -9,7 +9,7 @@ template: default
---*/
//- setup
var x;
let x;
//- elems
[, ...x]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -9,7 +9,7 @@ template: default
---*/
//- setup
var x, y;
let x, y;
//- elems
[, , x, , ...y]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
@ -8,22 +8,21 @@ info: |
ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
[...]
5. Let result be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
iteratorRecord as the argument
6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
7. Return result.
4. Let result be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
with iteratorRecord as the argument.
5. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
6. Return result.
features: [Symbol.iterator]
template: async-generator
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var x;
var iterator = {
let nextCount = 0;
let returnCount = 0;
let x;
let iterator = {
next() {
nextCount += 1;
return { done: true };
@ -32,7 +31,7 @@ var iterator = {
returnCount += 1;
}
};
var iterable = {
let iterable = {
[Symbol.iterator]() {
return iterator;
}
@ -45,10 +44,7 @@ iterable
assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 0);
iter.next().then(() => {
assert.throws(Test262Error, () => iter.return());
assert.sameValue(returnCount, 1);
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
})
//- teardown
iter.next()
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -1,65 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose is called when reference evaluation produces a "return"
completion
info: |
ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
[...]
5. Let result be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
iteratorRecord as the argument
6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
ArrayLiteral, then
a. Let lref be the result of evaluating DestructuringAssignmentTarget.
b. ReturnIfAbrupt(lref).
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
7. If completion.[[type]] is throw, return Completion(completion).
8. If innerResult.[[type]] is throw, return Completion(innerResult).
features: [Symbol.iterator, generators]
template: async-generator
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
function ReturnError() {}
var returnCount = 0;
var unreachable = 0;
var iterator = {
return() {
returnCount += 1;
throw new Test262Error();
}
};
var iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[...{}[yield]]
//- vals
iterable
//- body
unreachable += 1;
//- teardown
iter.next().then(() => {
assert.throws(Test262Error, () => iter.return());
assert.sameValue(returnCount, 1);
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
}).then($DONE, $DONE);

View File

@ -1,66 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose throws a TypeError when `return` returns a non-Object value
info: |
ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
[...]
5. Let result be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
iteratorRecord as the argument
6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
ArrayLiteral, then
a. Let lref be the result of evaluating DestructuringAssignmentTarget.
b. ReturnIfAbrupt(lref).
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
[...]
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
7. If completion.[[type]] is throw, return Completion(completion).
8. If innerResult.[[type]] is throw, return Completion(innerResult).
features: [Symbol.iterator, generators]
template: async-generator
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var iterable = {};
var iterator = {
return() {
return null;
}
};
var iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[...{}[yield]]
//- vals
iterable
//- teardown
iter.next().then(() => {
assert.throws(Test262Error, () => iter.return());
assert.sameValue(returnCount, 1);
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
}).then($DONE, $DONE);

View File

@ -1,83 +0,0 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
IteratorClose is called when reference evaluation produces a "return"
completion
info: |
ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
[...]
5. Let result be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
iteratorRecord as the argument
6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
ArrayLiteral, then
a. Let lref be the result of evaluating DestructuringAssignmentTarget.
b. ReturnIfAbrupt(lref).
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
[...]
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
7. If completion.[[type]] is throw, return Completion(completion).
8. If innerResult.[[type]] is throw, return Completion(innerResult).
features: [Symbol.iterator, generators]
template: async-generator
esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var returnCount = 0;
var unreachable = 0;
var thisValue = null;
var args = null;
var iterator = {
return() {
returnCount += 1;
thisValue = this;
args = arguments;
return {};
}
};
var iterable = {
[Symbol.iterator]() {
return iterator;
}
};
//- elems
[...{}[yield]]
//- vals
iterable
//- body
unreachable += 1;
//- teardown
iter.next().then(() => {
iter.return(444).then(result => {
assert.sameValue(returnCount, 1);
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
assert.sameValue(result.value, 444);
assert(result.done, 'Iterator correctly closed');
assert.sameValue(thisValue, iterator, 'correct `this` value');
assert(!!args, 'arguments object provided');
assert.sameValue(args.length, 0, 'zero arguments specified');
}).then($DONE, $DONE);
});

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,15 +11,15 @@ features: [generators]
---*/
//- setup
var count = 0;
var g = function*() {
let count = 0;
let g = function*() {
count += 1;
yield;
count += 1;
yield;
count += 1;
}
var x;
let x;
//- elems
[...x]
//- vals
@ -27,4 +27,9 @@ g()
//- body
assert.sameValue(count, 3);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Reference is evaluated during assignment
@ -6,11 +6,11 @@ info: |
ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
[...]
5. Let result be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
iteratorRecord as the argument
6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
4. Let result be the result of performing
IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
with iteratorRecord as the argument.
5. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
@ -25,9 +25,9 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
var nextCount = 0;
var returnCount = 0;
var iterator = {
let nextCount = 0;
let returnCount = 0;
let iterator = {
next() {
nextCount += 1;
return { done: true };
@ -36,8 +36,8 @@ var iterator = {
returnCount += 1;
}
};
var obj = {};
var iterable = {
let obj = {};
let iterable = {
[Symbol.iterator]() {
return iterator;
}
@ -52,4 +52,8 @@ assert.sameValue(returnCount, 0);
assert(!!obj.ab);
assert.sameValue(obj.ab.length, 0);
//- teardown
iter.next()
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -10,7 +10,7 @@ template: default
---*/
//- setup
var x, y;
let x, y;
//- elems
[...[x, y]]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,7 +11,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x = null;
let x = null;
//- elems
[...[x]]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,7 +11,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x = null;
let x = null;
//- elems
[...[x]]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,7 +11,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x = null;
let x = null;
//- elems
[...[x]]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,8 +11,7 @@ features: [generators]
---*/
//- setup
var value = [86];
var x = {};
let x = {};
//- elems
[...[x[yield]]]
@ -24,9 +23,7 @@ iter.next().then(iterationResult => {
assert.sameValue(iterationResult.done, false);
assert.sameValue(x.prop, undefined);
// TODO add iterCount
//
iter.next(86).then(iterationResult => {
iter.next('prop').then(iterationResult => {
assert.sameValue(iterationResult.value, undefined);
assert.sameValue(iterationResult.done, true);
assert.sameValue(x.prop, 86);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -6,13 +6,13 @@ desc: >
When a `yield` token appears within the DestructuringAssignmentTarget of a
nested destructuring assignment and outside of a generator function body,
it should behave as an IdentifierExpression.
template: default
template: async-function
flags: [noStrict]
---*/
//- setup
var yield = 'prop';
var x = {};
let yield = 'prop';
let x = {};
//- elems
[...[x[yield]]]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,7 +11,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x;
let x;
//- elems
[...[x]]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,7 +11,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x, length;
let x, length;
//- elems
[...{ 0: x, length }]
//- vals

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,7 +11,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x = null;
let x = null;
// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
// where length and name are properties of WindowProxy
let length;
@ -22,3 +22,8 @@ let length;
//- body
assert.sameValue(x, undefined);
assert.sameValue(length, 1);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,7 +11,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x = null;
let x = null;
// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
// where length and name are properties of WindowProxy
let length;
@ -22,3 +22,8 @@ let length;
//- body
assert.sameValue(x, undefined);
assert.sameValue(length, 1);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -11,7 +11,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x = null;
let x = null;
// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
// where length and name are properties of WindowProxy
let length;
@ -22,3 +22,8 @@ let length;
//- body
assert.sameValue(x, undefined);
assert.sameValue(length, 0);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -11,7 +11,7 @@ features: [generators]
---*/
//- setup
var x;
let x;
//- elems
[...{ x = yield }]
@ -23,8 +23,6 @@ iter.next().then(iterationResult => {
assert.sameValue(iterationResult.done, false);
assert.sameValue(x, undefined);
// TODO add iterCount
//
iter.next(4).then(iterationResult => {
assert.sameValue(iterationResult.value, undefined);
assert.sameValue(iterationResult.done, true);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -6,16 +6,21 @@ desc: >
When a `yield` token appears within the Initializer of a nested
destructuring assignment and outside of a generator function body, it
should behave as an IdentifierExpression.
template: default
template: async-function
flags: [noStrict]
---*/
//- setup
var yield = 2;
var x;
let yield = 2;
let x;
//- elems
[...{ x = yield }]
//- vals
[{}]
//- body
assert.sameValue(x, 2);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -10,10 +10,14 @@ template: default
---*/
//- setup
var x;
let x;
//- elems
[...{ 1: x }]
//- vals
[1, 2, 3]
//- body
assert.sameValue(x, 2);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -10,8 +10,8 @@ es6id: 12.14.5.3
---*/
//- setup
var setValue;
var x = {
let setValue;
let x = {
get y() {
$ERROR('The property should not be accessed.');
},
@ -28,3 +28,7 @@ assert.sameValue(setValue.length, 3);
assert.sameValue(setValue[0], 23);
assert.sameValue(setValue[1], 45);
assert.sameValue(setValue[2], 99);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
@ -10,7 +10,7 @@ es6id: 12.14.5.3
---*/
//- setup
var x = {};
let x = {};
//- elems
[...x.y]
//- vals
@ -20,3 +20,7 @@ assert.sameValue(x.y.length, 3);
assert.sameValue(x.y[0], 4);
assert.sameValue(x.y[1], 3);
assert.sameValue(x.y[2], 2);
//- teardown
promise
.then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);

Some files were not shown because too many files have changed in this diff Show More