Generate tests

This commit is contained in:
Mike Pennisi 2016-04-18 14:07:34 -04:00
parent b7d496942a
commit 18a2ba862d
54 changed files with 2463 additions and 9 deletions

View File

@ -0,0 +1,34 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-expr-throws.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator following other arguments when evaluation throws (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
es6id: 12.3.4.1
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
---*/
assert.throws(Test262Error, function() {
(function() {}(0, ...function*() { throw new Test262Error(); }()));
});

View File

@ -0,0 +1,47 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-iter-get-value.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator following other arguments when GetIterator fails (@@iterator function return value) (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.1 GetIterator ( obj, method )
[...]
2. Let iterator be ? Call(method, obj).
3. If Type(iterator) is not Object, throw a TypeError exception.
---*/
var iter = {};
Object.defineProperty(iter, Symbol.iterator, {
get: function() {
return null;
}
});
assert.throws(TypeError, function() {
(function() {}(0, ...iter));
});

View File

@ -0,0 +1,45 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-get-call.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator following other arguments when GetIterator fails (@@iterator function invocation) (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.1 GetIterator ( obj, method )
[...]
3. Let iterator be Call(method,obj).
4. ReturnIfAbrupt(iterator).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
throw new Test262Error();
};
assert.throws(Test262Error, function() {
(function() {}(0, ...iter));
});

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-get-get.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator following other arguments when GetIterator fails (@@iterator property access) (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.1 GetIterator ( obj, method )
1. If method was not passed, then
a. Let method be ? GetMethod(obj, @@iterator).
---*/
var iter = {};
Object.defineProperty(iter, Symbol.iterator, {
get: function() {
throw new Test262Error();
}
});
assert.throws(Test262Error, function() {
(function() {}(0, ...iter));
});

View File

@ -0,0 +1,55 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-step.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator following other arguments when IteratorStep fails (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.5 IteratorStep ( iterator )
1. Let result be IteratorNext(iterator).
2. ReturnIfAbrupt(result).
7.4.2 IteratorNext ( iterator, value )
1. If value was not passed, then
a. Let result be Invoke(iterator, "next", « »).
[...]
3. ReturnIfAbrupt(result).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
return {
next: function() {
throw new Test262Error();
}
};
};
assert.throws(Test262Error, function() {
(function() {}(0, ...iter));
});

View File

@ -0,0 +1,58 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-value.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator following other arguments when IteratorValue fails (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.4 IteratorValue ( iterResult )
1. Assert: Type(iterResult) is Object.
2. Return Get(iterResult, "value").
7.3.1 Get (O, P)
[...]
3. Return O.[[Get]](P, O).
---*/
var iter = {};
var poisonedValue = Object.defineProperty({}, 'value', {
get: function() {
throw new Test262Error();
}
});
iter[Symbol.iterator] = function() {
return {
next: function() {
return poisonedValue;
}
};
};
assert.throws(Test262Error, function() {
(function() {}(0, ...iter));
});

View File

@ -0,0 +1,41 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-unresolvable.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator following other arguments when reference is unresolvable (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
es6id: 12.3.4.1
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
6.2.3.1 GetValue (V)
1. ReturnIfAbrupt(V).
2. If Type(V) is not Reference, return V.
3. Let base be GetBase(V).
4. If IsUnresolvableReference(V), throw a ReferenceError exception.
---*/
assert.throws(ReferenceError, function() {
(function() {}(0, ...unresolvableReference));
});

View File

@ -3,6 +3,7 @@
// - src/spread/error/call-expr.template
/*---
description: Spread operator applied to the only argument when evaluation throws (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
es6id: 12.3.4.1
features: [generators]
flags: [generated]

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-get-call.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator applied to the only argument when GetIterator fails (@@iterator function invocation) (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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).
7.4.1 GetIterator ( obj, method )
[...]
3. Let iterator be Call(method,obj).
4. ReturnIfAbrupt(iterator).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
throw new Test262Error();
};
assert.throws(Test262Error, function() {
(function() {}(...iter));
});

View File

@ -0,0 +1,47 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-get-get.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator applied to the only argument when GetIterator fails (@@iterator property access) (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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).
7.4.1 GetIterator ( obj, method )
1. If method was not passed, then
a. Let method be ? GetMethod(obj, @@iterator).
---*/
var iter = {};
Object.defineProperty(iter, Symbol.iterator, {
get: function() {
throw new Test262Error();
}
});
assert.throws(Test262Error, function() {
(function() {}(...iter));
});

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-get-value.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator applied to the only argument when GetIterator fails (@@iterator function return value) (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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).
7.4.1 GetIterator ( obj, method )
[...]
2. Let iterator be ? Call(method, obj).
3. If Type(iterator) is not Object, throw a TypeError exception.
---*/
var iter = {};
iter[Symbol.iterator] = function() {
return null;
};
assert.throws(TypeError, function() {
(function() {}(...iter));
});

View File

@ -0,0 +1,59 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-step.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator applied to the only argument when IteratorStep fails (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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).
7.4.5 IteratorStep ( iterator )
1. Let result be IteratorNext(iterator).
2. ReturnIfAbrupt(result).
7.4.2 IteratorNext ( iterator, value )
1. If value was not passed, then
a. Let result be Invoke(iterator, "next", « »).
[...]
3. ReturnIfAbrupt(result).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
return {
next: function() {
throw new Test262Error();
}
};
};
assert.throws(Test262Error, function() {
(function() {}(...iter));
});

View File

@ -0,0 +1,65 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-value.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator applied to the only argument when IteratorValue fails (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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).
7.4.4 IteratorValue ( iterResult )
1. Assert: Type(iterResult) is Object.
2. Return Get(iterResult, "value").
7.3.1 Get (O, P)
[...]
3. Return O.[[Get]](P, O).
---*/
var iter = {};
var poisonedValue = Object.defineProperty({}, 'value', {
get: function() {
throw new Test262Error();
}
});
iter[Symbol.iterator] = function() {
return {
next: function() {
return poisonedValue;
}
};
};
assert.throws(Test262Error, function() {
(function() {}(...iter));
});

View File

@ -0,0 +1,42 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-unresolvable.case
// - src/spread/error/call-expr.template
/*---
description: Spread operator applied to the only argument when reference is unresolvable (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
es6id: 12.3.4.1
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.2.3.1 GetValue (V)
1. ReturnIfAbrupt(V).
2. If Type(V) is not Reference, return V.
3. Let base be GetBase(V).
4. If IsUnresolvableReference(V), throw a ReferenceError exception.
---*/
assert.throws(ReferenceError, function() {
(function() {}(...unresolvableReference));
});

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-empty.case
// - src/spread/default/call-expr.template
/*---
description: Spread operator following other arguments when no iteration occurs (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
es6id: 12.3.4.1
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
5. Repeat
a. Let next be IteratorStep(iterator).
b. ReturnIfAbrupt(next).
c. If next is false, return precedingArgs.
---*/
var callCount = 0;
(function() {
assert.sameValue(arguments.length, 3);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);
assert.sameValue(arguments[2], 3);
callCount += 1;
}(1, 2, 3, ...[]));
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,63 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-iter.case
// - src/spread/default/call-expr.template
/*---
description: Spread operator following other arguments with a valid iterator (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
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 nextCount = 3;
return {
next: function() {
nextCount += 1;
return { done: nextCount === 6, value: nextCount };
}
};
};
var callCount = 0;
(function() {
assert.sameValue(arguments.length, 5);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);
assert.sameValue(arguments[2], 3);
assert.sameValue(arguments[3], 4);
assert.sameValue(arguments[4], 5);
callCount += 1;
}(1, 2, 3, ...iter));
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,45 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-empty.case
// - src/spread/default/call-expr.template
/*---
description: Spread operator applied to the only argument when no iteration occurs (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
es6id: 12.3.4.1
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.
[...]
---*/
var callCount = 0;
(function() {
assert.sameValue(arguments.length, 0);
callCount += 1;
}(...[]));
assert.sameValue(callCount, 1);

View File

@ -3,6 +3,7 @@
// - src/spread/default/call-expr.template
/*---
description: Spread operator applied to the only argument with a valid iterator (CallExpression)
esid: sec-function-calls-runtime-semantics-evaluation
es6id: 12.3.4.1
features: [Symbol.iterator]
flags: [generated]
@ -38,11 +39,11 @@ info: |
---*/
var iter = {};
iter[Symbol.iterator] = function() {
var callCount = 0;
var nextCount = 0;
return {
next: function() {
callCount += 1;
return { done: callCount === 3, value: callCount };
nextCount += 1;
return { done: nextCount === 3, value: nextCount };
}
};
};

View File

@ -0,0 +1,33 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-expr-throws.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator following other arguments when evaluation throws (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
es6id: 12.3.3.1
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
---*/
assert.throws(Test262Error, function() {
new function() {}(0, ...function*() { throw new Test262Error(); }());
});

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-iter-get-value.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator following other arguments when GetIterator fails (@@iterator function return value) (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.1 GetIterator ( obj, method )
[...]
2. Let iterator be ? Call(method, obj).
3. If Type(iterator) is not Object, throw a TypeError exception.
---*/
var iter = {};
Object.defineProperty(iter, Symbol.iterator, {
get: function() {
return null;
}
});
assert.throws(TypeError, function() {
new function() {}(0, ...iter);
});

View File

@ -0,0 +1,44 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-get-call.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator following other arguments when GetIterator fails (@@iterator function invocation) (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.1 GetIterator ( obj, method )
[...]
3. Let iterator be Call(method,obj).
4. ReturnIfAbrupt(iterator).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
throw new Test262Error();
};
assert.throws(Test262Error, function() {
new function() {}(0, ...iter);
});

View File

@ -0,0 +1,45 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-get-get.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator following other arguments when GetIterator fails (@@iterator property access) (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.1 GetIterator ( obj, method )
1. If method was not passed, then
a. Let method be ? GetMethod(obj, @@iterator).
---*/
var iter = {};
Object.defineProperty(iter, Symbol.iterator, {
get: function() {
throw new Test262Error();
}
});
assert.throws(Test262Error, function() {
new function() {}(0, ...iter);
});

View File

@ -0,0 +1,54 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-step.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator following other arguments when IteratorStep fails (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.5 IteratorStep ( iterator )
1. Let result be IteratorNext(iterator).
2. ReturnIfAbrupt(result).
7.4.2 IteratorNext ( iterator, value )
1. If value was not passed, then
a. Let result be Invoke(iterator, "next", « »).
[...]
3. ReturnIfAbrupt(result).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
return {
next: function() {
throw new Test262Error();
}
};
};
assert.throws(Test262Error, function() {
new function() {}(0, ...iter);
});

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-value.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator following other arguments when IteratorValue fails (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.4 IteratorValue ( iterResult )
1. Assert: Type(iterResult) is Object.
2. Return Get(iterResult, "value").
7.3.1 Get (O, P)
[...]
3. Return O.[[Get]](P, O).
---*/
var iter = {};
var poisonedValue = Object.defineProperty({}, 'value', {
get: function() {
throw new Test262Error();
}
});
iter[Symbol.iterator] = function() {
return {
next: function() {
return poisonedValue;
}
};
};
assert.throws(Test262Error, function() {
new function() {}(0, ...iter);
});

View File

@ -0,0 +1,40 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-unresolvable.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator following other arguments when reference is unresolvable (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
es6id: 12.3.3.1
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
6.2.3.1 GetValue (V)
1. ReturnIfAbrupt(V).
2. If Type(V) is not Reference, return V.
3. Let base be GetBase(V).
4. If IsUnresolvableReference(V), throw a ReferenceError exception.
---*/
assert.throws(ReferenceError, function() {
new function() {}(0, ...unresolvableReference);
});

View File

@ -3,6 +3,7 @@
// - src/spread/error/member-expr.template
/*---
description: Spread operator applied to the only argument when evaluation throws (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
es6id: 12.3.3.1
features: [generators]
flags: [generated]

View File

@ -0,0 +1,45 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-get-call.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator applied to the only argument when GetIterator fails (@@iterator function invocation) (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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).
7.4.1 GetIterator ( obj, method )
[...]
3. Let iterator be Call(method,obj).
4. ReturnIfAbrupt(iterator).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
throw new Test262Error();
};
assert.throws(Test262Error, function() {
new function() {}(...iter);
});

View File

@ -0,0 +1,46 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-get-get.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator applied to the only argument when GetIterator fails (@@iterator property access) (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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).
7.4.1 GetIterator ( obj, method )
1. If method was not passed, then
a. Let method be ? GetMethod(obj, @@iterator).
---*/
var iter = {};
Object.defineProperty(iter, Symbol.iterator, {
get: function() {
throw new Test262Error();
}
});
assert.throws(Test262Error, function() {
new function() {}(...iter);
});

View File

@ -0,0 +1,45 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-get-value.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator applied to the only argument when GetIterator fails (@@iterator function return value) (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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).
7.4.1 GetIterator ( obj, method )
[...]
2. Let iterator be ? Call(method, obj).
3. If Type(iterator) is not Object, throw a TypeError exception.
---*/
var iter = {};
iter[Symbol.iterator] = function() {
return null;
};
assert.throws(TypeError, function() {
new function() {}(...iter);
});

View File

@ -0,0 +1,58 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-step.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator applied to the only argument when IteratorStep fails (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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).
7.4.5 IteratorStep ( iterator )
1. Let result be IteratorNext(iterator).
2. ReturnIfAbrupt(result).
7.4.2 IteratorNext ( iterator, value )
1. If value was not passed, then
a. Let result be Invoke(iterator, "next", « »).
[...]
3. ReturnIfAbrupt(result).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
return {
next: function() {
throw new Test262Error();
}
};
};
assert.throws(Test262Error, function() {
new function() {}(...iter);
});

View File

@ -0,0 +1,64 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-value.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator applied to the only argument when IteratorValue fails (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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).
7.4.4 IteratorValue ( iterResult )
1. Assert: Type(iterResult) is Object.
2. Return Get(iterResult, "value").
7.3.1 Get (O, P)
[...]
3. Return O.[[Get]](P, O).
---*/
var iter = {};
var poisonedValue = Object.defineProperty({}, 'value', {
get: function() {
throw new Test262Error();
}
});
iter[Symbol.iterator] = function() {
return {
next: function() {
return poisonedValue;
}
};
};
assert.throws(Test262Error, function() {
new function() {}(...iter);
});

View File

@ -0,0 +1,41 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-unresolvable.case
// - src/spread/error/member-expr.template
/*---
description: Spread operator applied to the only argument when reference is unresolvable (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
es6id: 12.3.3.1
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.2.3.1 GetValue (V)
1. ReturnIfAbrupt(V).
2. If Type(V) is not Reference, return V.
3. Let base be GetBase(V).
4. If IsUnresolvableReference(V), throw a ReferenceError exception.
---*/
assert.throws(ReferenceError, function() {
new function() {}(...unresolvableReference);
});

View File

@ -0,0 +1,45 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-empty.case
// - src/spread/default/member-expr.template
/*---
description: Spread operator following other arguments when no iteration occurs (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
es6id: 12.3.3.1
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
5. Repeat
a. Let next be IteratorStep(iterator).
b. ReturnIfAbrupt(next).
c. If next is false, return precedingArgs.
---*/
var callCount = 0;
new function() {
assert.sameValue(arguments.length, 3);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);
assert.sameValue(arguments[2], 3);
callCount += 1;
}(1, 2, 3, ...[]);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,62 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-iter.case
// - src/spread/default/member-expr.template
/*---
description: Spread operator following other arguments with a valid iterator (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
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 nextCount = 3;
return {
next: function() {
nextCount += 1;
return { done: nextCount === 6, value: nextCount };
}
};
};
var callCount = 0;
new function() {
assert.sameValue(arguments.length, 5);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);
assert.sameValue(arguments[2], 3);
assert.sameValue(arguments[3], 4);
assert.sameValue(arguments[4], 5);
callCount += 1;
}(1, 2, 3, ...iter);
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,44 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-empty.case
// - src/spread/default/member-expr.template
/*---
description: Spread operator applied to the only argument when no iteration occurs (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
es6id: 12.3.3.1
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.
[...]
---*/
var callCount = 0;
new function() {
assert.sameValue(arguments.length, 0);
callCount += 1;
}(...[]);
assert.sameValue(callCount, 1);

View File

@ -3,6 +3,7 @@
// - src/spread/default/member-expr.template
/*---
description: Spread operator applied to the only argument with a valid iterator (`new` operator)
esid: sec-new-operator-runtime-semantics-evaluation
es6id: 12.3.3.1
features: [Symbol.iterator]
flags: [generated]
@ -37,11 +38,11 @@ info: |
---*/
var iter = {};
iter[Symbol.iterator] = function() {
var callCount = 0;
var nextCount = 0;
return {
next: function() {
callCount += 1;
return { done: callCount === 3, value: callCount };
nextCount += 1;
return { done: nextCount === 3, value: nextCount };
}
};
};

View File

@ -0,0 +1,41 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-expr-throws.case
// - src/spread/error/super-call.template
/*---
description: Spread operator following other arguments when evaluation throws (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
es6id: 12.3.5.1
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
---*/
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(0, ...function*() { throw new Test262Error(); }());
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,54 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-iter-get-value.case
// - src/spread/error/super-call.template
/*---
description: Spread operator following other arguments when GetIterator fails (@@iterator function return value) (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.1 GetIterator ( obj, method )
[...]
2. Let iterator be ? Call(method, obj).
3. If Type(iterator) is not Object, throw a TypeError exception.
---*/
var iter = {};
Object.defineProperty(iter, Symbol.iterator, {
get: function() {
return null;
}
});
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(0, ...iter);
}
}
assert.throws(TypeError, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,52 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-get-call.case
// - src/spread/error/super-call.template
/*---
description: Spread operator following other arguments when GetIterator fails (@@iterator function invocation) (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.1 GetIterator ( obj, method )
[...]
3. Let iterator be Call(method,obj).
4. ReturnIfAbrupt(iterator).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
throw new Test262Error();
};
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(0, ...iter);
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,53 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-get-get.case
// - src/spread/error/super-call.template
/*---
description: Spread operator following other arguments when GetIterator fails (@@iterator property access) (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.1 GetIterator ( obj, method )
1. If method was not passed, then
a. Let method be ? GetMethod(obj, @@iterator).
---*/
var iter = {};
Object.defineProperty(iter, Symbol.iterator, {
get: function() {
throw new Test262Error();
}
});
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(0, ...iter);
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,62 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-step.case
// - src/spread/error/super-call.template
/*---
description: Spread operator following other arguments when IteratorStep fails (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.5 IteratorStep ( iterator )
1. Let result be IteratorNext(iterator).
2. ReturnIfAbrupt(result).
7.4.2 IteratorNext ( iterator, value )
1. If value was not passed, then
a. Let result be Invoke(iterator, "next", « »).
[...]
3. ReturnIfAbrupt(result).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
return {
next: function() {
throw new Test262Error();
}
};
};
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(0, ...iter);
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,65 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-itr-value.case
// - src/spread/error/super-call.template
/*---
description: Spread operator following other arguments when IteratorValue fails (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
7.4.4 IteratorValue ( iterResult )
1. Assert: Type(iterResult) is Object.
2. Return Get(iterResult, "value").
7.3.1 Get (O, P)
[...]
3. Return O.[[Get]](P, O).
---*/
var iter = {};
var poisonedValue = Object.defineProperty({}, 'value', {
get: function() {
throw new Test262Error();
}
});
iter[Symbol.iterator] = function() {
return {
next: function() {
return poisonedValue;
}
};
};
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(0, ...iter);
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,48 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-err-unresolvable.case
// - src/spread/error/super-call.template
/*---
description: Spread operator following other arguments when reference is unresolvable (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
es6id: 12.3.5.1
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
6.2.3.1 GetValue (V)
1. ReturnIfAbrupt(V).
2. If Type(V) is not Reference, return V.
3. Let base be GetBase(V).
4. If IsUnresolvableReference(V), throw a ReferenceError exception.
---*/
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(0, ...unresolvableReference);
}
}
assert.throws(ReferenceError, function() {
new Test262ChildClass();
});

View File

@ -3,6 +3,7 @@
// - src/spread/error/super-call.template
/*---
description: Spread operator applied to the only argument when evaluation throws (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
es6id: 12.3.5.1
features: [generators]
flags: [generated]

View File

@ -0,0 +1,53 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-get-call.case
// - src/spread/error/super-call.template
/*---
description: Spread operator applied to the only argument when GetIterator fails (@@iterator function invocation) (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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).
7.4.1 GetIterator ( obj, method )
[...]
3. Let iterator be Call(method,obj).
4. ReturnIfAbrupt(iterator).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
throw new Test262Error();
};
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(...iter);
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,54 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-get-get.case
// - src/spread/error/super-call.template
/*---
description: Spread operator applied to the only argument when GetIterator fails (@@iterator property access) (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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).
7.4.1 GetIterator ( obj, method )
1. If method was not passed, then
a. Let method be ? GetMethod(obj, @@iterator).
---*/
var iter = {};
Object.defineProperty(iter, Symbol.iterator, {
get: function() {
throw new Test262Error();
}
});
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(...iter);
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,53 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-get-value.case
// - src/spread/error/super-call.template
/*---
description: Spread operator applied to the only argument when GetIterator fails (@@iterator function return value) (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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).
7.4.1 GetIterator ( obj, method )
[...]
2. Let iterator be ? Call(method, obj).
3. If Type(iterator) is not Object, throw a TypeError exception.
---*/
var iter = {};
iter[Symbol.iterator] = function() {
return null;
};
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(...iter);
}
}
assert.throws(TypeError, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-step.case
// - src/spread/error/super-call.template
/*---
description: Spread operator applied to the only argument when IteratorStep fails (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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).
7.4.5 IteratorStep ( iterator )
1. Let result be IteratorNext(iterator).
2. ReturnIfAbrupt(result).
7.4.2 IteratorNext ( iterator, value )
1. If value was not passed, then
a. Let result be Invoke(iterator, "next", « »).
[...]
3. ReturnIfAbrupt(result).
---*/
var iter = {};
iter[Symbol.iterator] = function() {
return {
next: function() {
throw new Test262Error();
}
};
};
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(...iter);
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,72 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-itr-value.case
// - src/spread/error/super-call.template
/*---
description: Spread operator applied to the only argument when IteratorValue fails (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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).
7.4.4 IteratorValue ( iterResult )
1. Assert: Type(iterResult) is Object.
2. Return Get(iterResult, "value").
7.3.1 Get (O, P)
[...]
3. Return O.[[Get]](P, O).
---*/
var iter = {};
var poisonedValue = Object.defineProperty({}, 'value', {
get: function() {
throw new Test262Error();
}
});
iter[Symbol.iterator] = function() {
return {
next: function() {
return poisonedValue;
}
};
};
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(...iter);
}
}
assert.throws(Test262Error, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,49 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-err-unresolvable.case
// - src/spread/error/super-call.template
/*---
description: Spread operator applied to the only argument when reference is unresolvable (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
es6id: 12.3.5.1
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.2.3.1 GetValue (V)
1. ReturnIfAbrupt(V).
2. If Type(V) is not Reference, return V.
3. Let base be GetBase(V).
4. If IsUnresolvableReference(V), throw a ReferenceError exception.
---*/
class Test262ParentClass {
constructor() {}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(...unresolvableReference);
}
}
assert.throws(ReferenceError, function() {
new Test262ChildClass();
});

View File

@ -0,0 +1,52 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-empty.case
// - src/spread/default/super-call.template
/*---
description: Spread operator following other arguments when no iteration occurs (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
es6id: 12.3.5.1
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 : ArgumentList , ... AssignmentExpression
1. Let precedingArgs be the result of evaluating ArgumentList.
2. Let spreadRef be the result of evaluating AssignmentExpression.
3. Let iterator be GetIterator(GetValue(spreadRef) ).
4. ReturnIfAbrupt(iterator).
5. Repeat
a. Let next be IteratorStep(iterator).
b. ReturnIfAbrupt(next).
c. If next is false, return precedingArgs.
---*/
var callCount = 0;
class Test262ParentClass {
constructor() {
assert.sameValue(arguments.length, 3);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);
assert.sameValue(arguments[2], 3);
callCount += 1;
}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(1, 2, 3, ...[]);
}
}
new Test262ChildClass();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,69 @@
// This file was procedurally generated from the following sources:
// - src/spread/mult-iter.case
// - src/spread/default/super-call.template
/*---
description: Spread operator following other arguments with a valid iterator (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
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 nextCount = 3;
return {
next: function() {
nextCount += 1;
return { done: nextCount === 6, value: nextCount };
}
};
};
var callCount = 0;
class Test262ParentClass {
constructor() {
assert.sameValue(arguments.length, 5);
assert.sameValue(arguments[0], 1);
assert.sameValue(arguments[1], 2);
assert.sameValue(arguments[2], 3);
assert.sameValue(arguments[3], 4);
assert.sameValue(arguments[4], 5);
callCount += 1;
}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(1, 2, 3, ...iter);
}
}
new Test262ChildClass();
assert.sameValue(callCount, 1);

View File

@ -0,0 +1,51 @@
// This file was procedurally generated from the following sources:
// - src/spread/sngl-empty.case
// - src/spread/default/super-call.template
/*---
description: Spread operator applied to the only argument when no iteration occurs (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
es6id: 12.3.5.1
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.
[...]
---*/
var callCount = 0;
class Test262ParentClass {
constructor() {
assert.sameValue(arguments.length, 0);
callCount += 1;
}
}
class Test262ChildClass extends Test262ParentClass {
constructor() {
super(...[]);
}
}
new Test262ChildClass();
assert.sameValue(callCount, 1);

View File

@ -3,6 +3,7 @@
// - src/spread/default/super-call.template
/*---
description: Spread operator applied to the only argument with a valid iterator (SuperCall)
esid: sec-super-keyword-runtime-semantics-evaluation
es6id: 12.3.5.1
features: [Symbol.iterator]
flags: [generated]
@ -35,11 +36,11 @@ info: |
---*/
var iter = {};
iter[Symbol.iterator] = function() {
var callCount = 0;
var nextCount = 0;
return {
next: function() {
callCount += 1;
return { done: callCount === 3, value: callCount };
nextCount += 1;
return { done: nextCount === 3, value: nextCount };
}
};
};