Merge pull request #1532 from anba/compat-new

Various test cases for cross-browser compliance bugs
This commit is contained in:
Rick Waldron 2018-05-03 14:19:40 -04:00 committed by GitHub
commit 3b7a456ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 1190 additions and 0 deletions

View File

@ -0,0 +1,40 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-web-compat-functiondeclarationinstantiation
description: >
Nested function declarations, the second declaration is not Annex-B applicable.
info: |
B.3.3.1 Changes to FunctionDeclarationInstantiation
1. If strict is false, then
a. For each FunctionDeclaration f that is directly contained in the
StatementList of a Block, CaseClause, or DefaultClause, do
i. Let F be StringValue of the BindingIdentifier of FunctionDeclaration f.
ii. If replacing the FunctionDeclaration f with a VariableStatement that
has F as a BindingIdentifier would not produce any Early Errors for
func and F is not an element of parameterNames, then
...
flags: [noStrict]
---*/
function g() {
// Create an outer block-statement.
{
// A lexically declared function declaration.
// This function is applicable for Annex-B semantics.
function f() { return 1; }
// An inner block-statement with another function declaration.
// This function is not applicable for Annex-B semantics, because
// replacing it with |var f| would result in a SyntaxError.
{
function f() { return 2; }
}
}
assert.sameValue(f(), 1);
}
g();

View File

@ -0,0 +1,37 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.filter
description: >
Non-writable properties are overwritten by CreateDataPropertyOrThrow.
info: |
22.1.3.7 Array.prototype.filter ( callbackfn [ , thisArg ] )
...
8. Repeat, while k < len
...
c. If kPresent is true, then
...
iii. If selected is true, then
1. Perform ? CreateDataPropertyOrThrow(A, ! ToString(to), kValue).
...
features: [Symbol.species]
includes: [propertyHelper.js]
---*/
var a = [1];
a.constructor = {};
a.constructor[Symbol.species] = function(len) {
var q = new Array(0);
Object.defineProperty(q, 0, {
value: 0, writable: false, configurable: true, enumerable: false,
});
return q;
};
var r = a.filter(function(){ return true; });
verifyProperty(r, 0, {
value: 1, writable: true, configurable: true, enumerable: true,
});

View File

@ -0,0 +1,43 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.indexof
description: >
Calls [[HasProperty]] on the prototype to check for existing elements.
info: |
22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
...
2. Let len be ? ToLength(? Get(O, "length")).
...
4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step produces the value 0.)
...
8. Repeat, while k < len
a. Let kPresent be ? HasProperty(O, ! ToString(k)).
b. If kPresent is true, then
i. Let elementK be ? Get(O, ! ToString(k)).
...
includes: [proxyTrapsHelper.js]
features: [Proxy]
---*/
var array = [1, null, 3];
Object.setPrototypeOf(array, new Proxy(Array.prototype, allowProxyTraps({
has: function(t, pk) {
return pk in t;
}
})));
var fromIndex = {
valueOf: function() {
// Zero the array's length. The loop in step 8 iterates over the original
// length value of 100, but the only prototype MOP method which should be
// called is [[HasProperty]].
array.length = 0;
return 0;
}
};
Array.prototype.indexOf.call(array, 100, fromIndex);

View File

@ -0,0 +1,43 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.lastindexof
description: >
Calls [[HasProperty]] on the prototype to check for existing elements.
info: |
22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
...
2. Let len be ? ToLength(? Get(O, "length")).
...
4. If fromIndex is present, let n be ? ToInteger(fromIndex); else let n be len-1.
...
7. Repeat, while k 0
a. Let kPresent be ? HasProperty(O, ! ToString(k)).
b. If kPresent is true, then
i. Let elementK be ? Get(O, ! ToString(k)).
...
includes: [proxyTrapsHelper.js]
features: [Proxy]
---*/
var array = [5, undefined, 7];
Object.setPrototypeOf(array, new Proxy(Array.prototype, allowProxyTraps({
has: function(t, pk) {
return pk in t;
}
})));
var fromIndex = {
valueOf: function() {
// Zero the array's length. The loop in step 8 iterates over the original
// length value of 100, but the only prototype MOP method which should be
// called is [[HasProperty]].
array.length = 0;
return 2;
}
};
Array.prototype.lastIndexOf.call(array, 100, fromIndex);

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.map
description: >
Non-writable properties are overwritten by CreateDataPropertyOrThrow.
info: |
22.1.3.16 Array.prototype.map ( callbackfn [ , thisArg ] )
...
7. Repeat, while k < len
...
c. If kPresent is true, then
...
iii. Perform ? CreateDataPropertyOrThrow(A, Pk, mappedValue).
...
features: [Symbol.species]
includes: [propertyHelper.js]
---*/
var a = [1];
a.constructor = {};
a.constructor[Symbol.species] = function(len) {
var q = new Array(0);
Object.defineProperty(q, 0, {
value: 0, writable: false, configurable: true, enumerable: false,
});
return q;
};
var r = a.map(function(){ return 2; });
verifyProperty(r, 0, {
value: 2, writable: true, configurable: true, enumerable: true,
});

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.slice
description: >
Non-writable properties are overwritten by CreateDataPropertyOrThrow.
info: |
22.1.3.23 Array.prototype.slice ( start, end )
...
10. Repeat, while k < final
...
c. If kPresent is true, then
...
ii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(n), kValue).
...
features: [Symbol.species]
includes: [propertyHelper.js]
---*/
var a = [1];
a.constructor = {};
a.constructor[Symbol.species] = function(len) {
var q = new Array(0);
Object.defineProperty(q, 0, {
value: 0, writable: false, configurable: true, enumerable: false,
});
return q;
};
var r = a.slice(0);
verifyProperty(r, 0, {
value: 1, writable: true, configurable: true, enumerable: true,
});

View File

@ -0,0 +1,38 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.splice
description: >
Ensure the correct property traps are called on the new array.
features: [Proxy, Symbol.species]
includes: [compareArray.js]
---*/
var log = [];
var a = [0, 1];
a.constructor = {};
a.constructor[Symbol.species] = function(len) {
return new Proxy(new Array(len), new Proxy({}, {
get(t, pk, r) {
log.push(pk);
}
}));
};
var r = a.splice(0);
assert.compareArray([
// Step 11.c.ii: CreateDataPropertyOrThrow(A, ! ToString(k), fromValue).
"defineProperty",
// Step 11.c.ii: CreateDataPropertyOrThrow(A, ! ToString(k), fromValue).
"defineProperty",
// Step 12: Perform ? Set(A, "length", actualDeleteCount, true).
"set",
"getOwnPropertyDescriptor",
"defineProperty",
], log);

View File

@ -0,0 +1,36 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.splice
description: >
Non-writable properties are overwritten by CreateDataPropertyOrThrow.
info: |
22.1.3.26 Array.prototype.splice ( start, deleteCount, ...items )
...
11. Repeat, while k < actualDeleteCount
...
c. If fromPresent is true, then
...
ii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(k), fromValue).
...
features: [Symbol.species]
includes: [propertyHelper.js]
---*/
var a = [1];
a.constructor = {};
a.constructor[Symbol.species] = function(len) {
var q = new Array(0);
Object.defineProperty(q, 0, {
value: 0, writable: false, configurable: true, enumerable: false,
});
return q;
};
var r = a.splice(0);
verifyProperty(r, 0, {
value: 1, writable: true, configurable: true, enumerable: true,
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-function.prototype.bind
description: >
The target function length can exceed 2**31-1.
info: |
19.2.3.2 Function.prototype.bind ( thisArg, ...args )
...
6. If targetHasLength is true, then
a. Let targetLen be ? Get(Target, "length").
b. If Type(targetLen) is not Number, let L be 0.
c. Else,
i. Let targetLen be ToInteger(targetLen).
ii. Let L be the larger of 0 and the result of targetLen minus the number of elements of args.
...
8. Perform ! SetFunctionLength(F, L).
...
---*/
function f(){}
Object.defineProperty(f, "length", {value: 2147483648});
assert.sameValue(f.bind().length, 2147483648);

View File

@ -0,0 +1,61 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-object.assign
description: >
Symbol-valued properties are copied after String-valued properties.
info: |
19.1.2.1 Object.assign ( target, ...sources )
...
4. For each element nextSource of sources, in ascending index order, do
a. ...
b. Else,
i. Let from be ! ToObject(nextSource).
ii. Let keys be ? from.[[OwnPropertyKeys]]().
c. For each element nextKey of keys in List order, do
...
...
9.1.11.1 OrdinaryOwnPropertyKeys ( O )
...
3. For each own property key P of O that is a String but is not an integer index,
in ascending chronological order of property creation, do
a. Add P as the last element of keys.
4. For each own property key P of O that is a Symbol, in ascending chronological
order of property creation, do
a. Add P as the last element of keys.
...
includes: [compareArray.js]
---*/
var log = [];
var sym1 = Symbol("x");
var sym2 = Symbol("y");
var source = {};
Object.defineProperty(source, sym1, {
get: function(){ log.push("get sym(x)") },
enumerable: true, configurable: true,
});
Object.defineProperty(source, "a", {
get: function(){ log.push("get a") },
enumerable: true, configurable: true,
});
Object.defineProperty(source, sym2, {
get: function(){ log.push("get sym(y)") },
enumerable: true, configurable: true,
});
Object.defineProperty(source, "b", {
get: function(){ log.push("get b") },
enumerable: true, configurable: true,
});
var target = Object.assign({}, source);
assert.compareArray(log, ["get a", "get b", "get sym(x)", "get sym(y)"]);

View File

@ -0,0 +1,37 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-object.keys
description: >
Ensure the correct property traps are called on a proxy of an array.
info: |
19.1.2.16 Object.keys ( O )
...
2. Let nameList be ? EnumerableOwnPropertyNames(obj, "key").
...
7.3.21 EnumerableOwnPropertyNames ( O, kind )
...
2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
...
4. For each element key of ownKeys in List order, do
a. If Type(key) is String, then
i. Let desc be ? O.[[GetOwnProperty]](key).
...
features: [Proxy]
includes: [compareArray.js]
---*/
var log = [];
Object.keys(new Proxy([], new Proxy({},{
get(t, pk, r) {
log.push(pk);
}
})));
assert.compareArray([
"ownKeys",
"getOwnPropertyDescriptor",
], log);

View File

@ -0,0 +1,17 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sup-array.prototype.tolocalestring
description: >
Ensure "toLocaleString" is called with locale and options on number elements.
---*/
var n = 0;
var locale = "th-u-nu-thai";
var options = {
minimumFractionDigits: 3
};
assert.sameValue([n].toLocaleString(locale, options), n.toLocaleString(locale, options));

View File

@ -0,0 +1,23 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sup-array.prototype.tolocalestring
description: >
Ensure "toLocaleString" is called with locale and options on number elements.
includes: [testTypedArray.js]
features: [TypedArray]
---*/
var n = 0;
var locale = "th-u-nu-thai";
var options = {
minimumFractionDigits: 3
};
var expected = n.toLocaleString(locale, options);
testWithTypedArrayConstructors(function(TA) {
assert.sameValue(new TA([n]).toLocaleString(locale, options), expected);
});

View File

@ -0,0 +1,31 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-block-static-semantics-early-errors
description: >
Redeclaration with VariableDeclaration (FunctionDeclaration in BlockStatement)
info: |
13.2.1 Static Semantics: Early Errors
It is a Syntax Error if any element of the LexicallyDeclaredNames of
StatementList also occurs in the VarDeclaredNames of StatementList.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function g() {
// Create an outer block-statement.
{
// A lexically declared function declaration.
function f() {}
// An inner block-statement with a variable-declared name.
{
var f;
}
}
}

View File

@ -0,0 +1,15 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
description: >
It is a SyntaxError if FormalParameters' default expressions contains await.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
async(a = await => {}) => {};

View File

@ -0,0 +1,15 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
description: >
It is a SyntaxError if FormalParameters' default expressions contains await.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
async() => { (a = await/r/g) => {} };

View File

@ -0,0 +1,15 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
description: >
It is a SyntaxError if FormalParameters' default expressions contains await.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
async(a = (await) => {}) => {};

View File

@ -0,0 +1,15 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
description: >
It is a SyntaxError if FormalParameters' default expressions contains await.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
async(a = (...await) => {}) => {};

View File

@ -0,0 +1,29 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-async-arrow-function-definitions
description: >
Escaped "async" followed by a line-terminator is not misinterpreted as an AsyncArrowFunction.
info: |
14.7 Async Function Definitions
async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
5.1.5 Grammar Notation
Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
in fixed width font, both in the productions of the grammars and throughout this
specification whenever the text directly refers to such a terminal symbol. These
are to appear in a script exactly as written. All terminal symbol code points
specified in this way are to be understood as the appropriate Unicode code points
from the Basic Latin range, as opposed to any similar-looking code points from
other Unicode ranges.
features: [async-functions]
---*/
// Throws ReferenceError because reference for "async" cannot be resolved.
assert.throws(ReferenceError, function() {
\u0061sync
p => {}
});

View File

@ -0,0 +1,24 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-asyncgenerator-definitions-evaluatebody
description: >
The generator object is created after FunctionDeclarationInstantiation.
info: |
14.5.10 Runtime Semantics: EvaluateBody
1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList).
2. Let generator be ? OrdinaryCreateFromConstructor(functionObject, "%AsyncGeneratorPrototype%",
« [[AsyncGeneratorState]], [[AsyncGeneratorContext]], [[AsyncGeneratorQueue]] »).
3. Perform ! AsyncGeneratorStart(generator, FunctionBody).
...
features: [async-iteration]
---*/
var g = async function*(a = (g.prototype = null)) {}
var oldPrototype = g.prototype;
var it = g();
assert.notSameValue(Object.getPrototypeOf(it), oldPrototype);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`await` with escape sequence is a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if the goal symbol of the syntactic grammar is Module
and the StringValue of IdentifierName is "await".
negative:
phase: parse
type: SyntaxError
flags: [module]
---*/
throw "Test262: This statement should not be evaluated.";
var C = class aw\u0061it {};

View File

@ -0,0 +1,17 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`await` with escape sequence is a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if the goal symbol of the syntactic grammar is Module
and the StringValue of IdentifierName is "await".
---*/
var C = class aw\u0061it {};

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`await` is a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
IdentifierReference : yield
It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
negative:
phase: parse
type: SyntaxError
flags: [module]
---*/
throw "Test262: This statement should not be evaluated.";
var C = class await {};

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`await` is a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
IdentifierReference : yield
It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
---*/
var C = class await {};

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`let` with escape sequence is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var C = class l\u0065t {};

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`let` is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var C = class let {};

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`static` with escape sequence is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var C = class st\u0061tic {};

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`static` is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var C = class static {};

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`yield` with escape sequence is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var C = class yi\u0065ld {};

View File

@ -0,0 +1,25 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`yield` is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
IdentifierReference : yield
It is a Syntax Error if the code matched by this production is contained in strict mode code.
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var C = class yield {};

View File

@ -0,0 +1,24 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-generator-function-definitions-runtime-semantics-evaluatebody
description: >
The generator object is created after FunctionDeclarationInstantiation.
info: |
14.4.10 Runtime Semantics: EvaluateBody
1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList).
2. Let G be ? OrdinaryCreateFromConstructor(functionObject, "%GeneratorPrototype%",
« [[GeneratorState]], [[GeneratorContext]] »).
3. Perform GeneratorStart(G, FunctionBody).
...
features: [generators]
---*/
var g = function*(a = (g.prototype = null)) {}
var oldPrototype = g.prototype;
var it = g();
assert.notSameValue(Object.getPrototypeOf(it), oldPrototype);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-asyncgenerator-definitions-evaluatebody
description: >
The generator object is created after FunctionDeclarationInstantiation.
info: |
14.5.10 Runtime Semantics: EvaluateBody
1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList).
2. Let generator be ? OrdinaryCreateFromConstructor(functionObject, "%AsyncGeneratorPrototype%",
« [[AsyncGeneratorState]], [[AsyncGeneratorContext]], [[AsyncGeneratorQueue]] »).
3. Perform ! AsyncGeneratorStart(generator, FunctionBody).
...
features: [async-iteration]
---*/
async function* g(a = (g.prototype = null)) {}
var oldPrototype = g.prototype;
var it = g();
assert.notSameValue(Object.getPrototypeOf(it), oldPrototype);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`await` with escape sequence is a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if the goal symbol of the syntactic grammar is Module
and the StringValue of IdentifierName is "await".
negative:
phase: parse
type: SyntaxError
flags: [module]
---*/
throw "Test262: This statement should not be evaluated.";
class aw\u0061it {}

View File

@ -0,0 +1,17 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`await` with escape sequence is a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if the goal symbol of the syntactic grammar is Module
and the StringValue of IdentifierName is "await".
---*/
class aw\u0061it {}

View File

@ -0,0 +1,22 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`await` is a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
IdentifierReference : await
It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
negative:
phase: parse
type: SyntaxError
flags: [module]
---*/
throw "Test262: This statement should not be evaluated.";
class await {}

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`await` is a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
IdentifierReference : await
It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
---*/
class await {}

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`let` with escape sequence is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
class l\u0065t {}

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`let` is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
class let {}

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`static` with escape sequence is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
class st\u0061tic {}

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`static` is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
class static {}

View File

@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`yield` with escape sequence is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
class yi\u0065ld {}

View File

@ -0,0 +1,25 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`yield` is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
IdentifierReference : yield
It is a Syntax Error if the code matched by this production is contained in strict mode code.
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
class yield {}

View File

@ -0,0 +1,24 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-generator-function-definitions-runtime-semantics-evaluatebody
description: >
The generator object is created after FunctionDeclarationInstantiation.
info: |
14.4.10 Runtime Semantics: EvaluateBody
1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList).
2. Let G be ? OrdinaryCreateFromConstructor(functionObject, "%GeneratorPrototype%",
« [[GeneratorState]], [[GeneratorContext]] »).
3. Perform GeneratorStart(G, FunctionBody).
...
features: [generators]
---*/
function* g(a = (g.prototype = null)) {}
var oldPrototype = g.prototype;
var it = g();
assert.notSameValue(Object.getPrototypeOf(it), oldPrototype);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-try-statement-static-semantics-early-errors
description: >
Redeclaration of CatchParameter with directly nested FunctionDeclaration in function context.
info: |
13.15.1 Static Semantics: Early Errors
It is a Syntax Error if any element of the BoundNames of CatchParameter also
occurs in the LexicallyDeclaredNames of Block.
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
try {
} catch (e) {
function e(){}
}
}