Updates for ES2016 Draft 2015-12-01

- RegExp.prototype[Symbol.split] calls ToUint32 (https://github.com/tc39/ecma262/issues/92)
- Species lookup removed from Promise.all and Promise.race (https://github.com/tc39/ecma262/issues/151)
- Generator functions are no longer constructors (https://github.com/tc39/ecma262/pull/171)

Fixes #444
This commit is contained in:
André Bargull 2015-12-02 18:07:06 +01:00
parent fd44cd73df
commit bd8c91e250
11 changed files with 51 additions and 51 deletions

View File

@ -1,16 +0,0 @@
// Copyright (C) 2013 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 25.2
description: >
If the generator was invoked using [[Construct]], the this bind is not
initialized and any references to `this` within the FunctionBody will
produce a ReferenceError exception.
---*/
function* g() { this; }
var iter = new g();
assert.throws(ReferenceError, function() {
iter.next();
});

View File

@ -3,23 +3,23 @@
/*---
description: >
Error thrown when retrieving `Symbol.species` property of the `this` value
Promise.all() does not retrieve `Symbol.species` property of the `this` value
es6id: 25.4.4.1
info: >
1. Let C be the this value.
2. If Type(C) is not Object, throw a TypeError exception.
3. Let S be Get(C, @@species).
4. ReturnIfAbrupt(S).
3. Let promiseCapability be ? NewPromiseCapability(C).
...
features: [Symbol.species]
---*/
var C = {};
function C(executor) {
executor(function(){}, function(){});
}
Object.defineProperty(C, Symbol.species, {
get: function() {
throw new Test262Error();
$ERROR("Getter for Symbol.species called");
}
});
assert.throws(Test262Error, function() {
Promise.all.call(C);
});
Promise.all.call(C, []);

View File

@ -3,23 +3,23 @@
/*---
description: >
Error thrown when retrieving `Symbol.species` property of the `this` value
Promise.race() does not retrieve `Symbol.species` property of the `this` value
es6id: 25.4.4.3
info: >
1. Let C be the this value.
2. If Type(C) is not Object, throw a TypeError exception.
3. Let S be Get(C, @@species).
4. ReturnIfAbrupt(S).
3. Let promiseCapability be ? NewPromiseCapability(C).
...
features: [Symbol.species]
---*/
var C = {};
function C(executor) {
executor(function(){}, function(){});
}
Object.defineProperty(C, Symbol.species, {
get: function() {
throw new Test262Error();
$ERROR("Getter for Symbol.species called");
}
});
assert.throws(Test262Error, function() {
Promise.race.call(C);
});
Promise.race.call(C, []);

View File

@ -6,17 +6,17 @@ es6id: 21.2.5.11
description: Length coercion of `limit` argument
info: >
[...]
17. If limit is undefined, let lim be 2531; else let lim be
ToLength(limit).
17. If limit is undefined, let lim be 2^32-1; else let lim be ? ToUint32(limit).
[...]
features: [Symbol.split]
---*/
var result;
// ToUint32(-23) = 4294967273
result = /./[Symbol.split]('abc', -23);
assert(Array.isArray(result));
assert.sameValue(result.length, 0);
assert.sameValue(result.length, 4);
result = /./[Symbol.split]('abc', 1.9);
assert(Array.isArray(result));

View File

@ -10,4 +10,3 @@ es6id: 25.3
var g = function*() {};
assert(g() instanceof g, 'Instance created via function invocation');
assert(new g() instanceof g, 'Instance created via constructor invocation');

View File

@ -0,0 +1,14 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Generator expressions cannot be used as constructors.
es6id: 14.4
---*/
var g = function*(){};
assert.throws(TypeError, function() {
var instance = new g();
});

View File

@ -16,8 +16,3 @@ assert.sameValue(
g.prototype,
'Instance created via function invocation'
);
assert.sameValue(
Object.getPrototypeOf(new g()),
g.prototype,
'Instance created via constructor invocation'
);

View File

@ -3,13 +3,13 @@
/*---
description: >
Generator functions declared as methods may be used as constructors.
Generator functions declared as methods cannot be used as constructors.
es6id: 14.4.13
features: [generators]
---*/
var method = { *method() {} }.method;
var instance = new method();
assert.sameValue(instance instanceof method, true);
assert.throws(TypeError, function() {
var instance = new method();
});

View File

@ -10,4 +10,3 @@ es6id: 25.3
function* g() {}
assert(g() instanceof g, 'Instance created via function invocation');
assert(new g() instanceof g, 'Instance created via constructor invocation');

View File

@ -0,0 +1,14 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Generator statements cannot be used as constructors.
es6id: 14.4
---*/
function* g(){}
assert.throws(TypeError, function() {
var instance = new g();
});

View File

@ -16,8 +16,3 @@ assert.sameValue(
g.prototype,
'Instance created via function invocation'
);
assert.sameValue(
Object.getPrototypeOf(new g()),
g.prototype,
'Instance created via constructor invocation'
);