diff --git a/test/annexB/language/function-code/block-decl-nested-blocks-with-fun-decl.js b/test/annexB/language/function-code/block-decl-nested-blocks-with-fun-decl.js new file mode 100644 index 0000000000000000000000000000000000000000..d3fc1274ba5ff8b14558cf0da706c88b5110a688 --- /dev/null +++ b/test/annexB/language/function-code/block-decl-nested-blocks-with-fun-decl.js @@ -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(); diff --git a/test/built-ins/Array/prototype/filter/target-array-with-non-writable-property.js b/test/built-ins/Array/prototype/filter/target-array-with-non-writable-property.js new file mode 100644 index 0000000000000000000000000000000000000000..0197c1d9accf1d4b0784f870ac86212baed9bf91 --- /dev/null +++ b/test/built-ins/Array/prototype/filter/target-array-with-non-writable-property.js @@ -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, +}); diff --git a/test/built-ins/Array/prototype/indexOf/calls-only-has-on-prototype-after-length-zeroed.js b/test/built-ins/Array/prototype/indexOf/calls-only-has-on-prototype-after-length-zeroed.js new file mode 100644 index 0000000000000000000000000000000000000000..436f32bf06bb1eaddf85c8dba407ac15119f6573 --- /dev/null +++ b/test/built-ins/Array/prototype/indexOf/calls-only-has-on-prototype-after-length-zeroed.js @@ -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); diff --git a/test/built-ins/Array/prototype/lastIndexOf/calls-only-has-on-prototype-after-length-zeroed.js b/test/built-ins/Array/prototype/lastIndexOf/calls-only-has-on-prototype-after-length-zeroed.js new file mode 100644 index 0000000000000000000000000000000000000000..c9101a4e20e5e9f26594a4c6b9c037bdc2665ff5 --- /dev/null +++ b/test/built-ins/Array/prototype/lastIndexOf/calls-only-has-on-prototype-after-length-zeroed.js @@ -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); diff --git a/test/built-ins/Array/prototype/map/target-array-with-non-writable-property.js b/test/built-ins/Array/prototype/map/target-array-with-non-writable-property.js new file mode 100644 index 0000000000000000000000000000000000000000..842388af494f2f1d8d25794535d3fbdc6577147e --- /dev/null +++ b/test/built-ins/Array/prototype/map/target-array-with-non-writable-property.js @@ -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, +}); diff --git a/test/built-ins/Array/prototype/slice/target-array-with-non-writable-property.js b/test/built-ins/Array/prototype/slice/target-array-with-non-writable-property.js new file mode 100644 index 0000000000000000000000000000000000000000..ec7d1f05f7d40e957752a38662384b316f99e45e --- /dev/null +++ b/test/built-ins/Array/prototype/slice/target-array-with-non-writable-property.js @@ -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, +}); diff --git a/test/built-ins/Array/prototype/splice/property-traps-order-with-species.js b/test/built-ins/Array/prototype/splice/property-traps-order-with-species.js new file mode 100644 index 0000000000000000000000000000000000000000..4c8211b56df3f7d4ef88e71c87f4ffcea6993f6e --- /dev/null +++ b/test/built-ins/Array/prototype/splice/property-traps-order-with-species.js @@ -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); diff --git a/test/built-ins/Array/prototype/splice/target-array-with-non-writable-property.js b/test/built-ins/Array/prototype/splice/target-array-with-non-writable-property.js new file mode 100644 index 0000000000000000000000000000000000000000..dfb03318a2aab978fece918dfdd5dab342372747 --- /dev/null +++ b/test/built-ins/Array/prototype/splice/target-array-with-non-writable-property.js @@ -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, +}); diff --git a/test/built-ins/Function/prototype/bind/length-exceeds-int32.js b/test/built-ins/Function/prototype/bind/length-exceeds-int32.js new file mode 100644 index 0000000000000000000000000000000000000000..95fd81c0c4c1b8f3a38b0d6ac382f842b18f38e1 --- /dev/null +++ b/test/built-ins/Function/prototype/bind/length-exceeds-int32.js @@ -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); diff --git a/test/built-ins/Object/assign/strings-and-symbol-order.js b/test/built-ins/Object/assign/strings-and-symbol-order.js new file mode 100644 index 0000000000000000000000000000000000000000..8372154f9574b282837c16f3dfd580a85975a43b --- /dev/null +++ b/test/built-ins/Object/assign/strings-and-symbol-order.js @@ -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)"]); diff --git a/test/built-ins/Object/keys/property-traps-order-with-proxied-array.js b/test/built-ins/Object/keys/property-traps-order-with-proxied-array.js new file mode 100644 index 0000000000000000000000000000000000000000..c93d72771e8aaae3235d09a1550186f52e95988d --- /dev/null +++ b/test/built-ins/Object/keys/property-traps-order-with-proxied-array.js @@ -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); diff --git a/test/intl402/Array/prototype/toLocaleString/calls-toLocaleString-number-elements.js b/test/intl402/Array/prototype/toLocaleString/calls-toLocaleString-number-elements.js new file mode 100644 index 0000000000000000000000000000000000000000..62de5101b439705bc067a5a55ad0e8d3fd020764 --- /dev/null +++ b/test/intl402/Array/prototype/toLocaleString/calls-toLocaleString-number-elements.js @@ -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)); diff --git a/test/intl402/TypedArray/prototype/toLocaleString/calls-toLocaleString-number-elements.js b/test/intl402/TypedArray/prototype/toLocaleString/calls-toLocaleString-number-elements.js new file mode 100644 index 0000000000000000000000000000000000000000..db9d45d23d949d0f64c5fbb99903d8ae93e1171d --- /dev/null +++ b/test/intl402/TypedArray/prototype/toLocaleString/calls-toLocaleString-number-elements.js @@ -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); +}); diff --git a/test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js b/test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js new file mode 100644 index 0000000000000000000000000000000000000000..0c638faf6c39e5589e58478a01640f0c8a108997 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js @@ -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; + } + } +} diff --git a/test/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js b/test/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js new file mode 100644 index 0000000000000000000000000000000000000000..8823023178b3d49332143d36a7fe57a55d0b460b --- /dev/null +++ b/test/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js @@ -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 => {}) => {}; diff --git a/test/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js b/test/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js new file mode 100644 index 0000000000000000000000000000000000000000..bf6d180bf07955f134eccb9571d433658dbf6610 --- /dev/null +++ b/test/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js @@ -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) => {} }; diff --git a/test/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js b/test/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js new file mode 100644 index 0000000000000000000000000000000000000000..79266eaa546aa7e2fffbe66174f8d78fe2f30e42 --- /dev/null +++ b/test/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js @@ -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) => {}) => {}; diff --git a/test/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js b/test/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js new file mode 100644 index 0000000000000000000000000000000000000000..ca65bf19a7d9d4d6c9f19805445e70946b723697 --- /dev/null +++ b/test/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js @@ -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) => {}) => {}; diff --git a/test/language/expressions/async-arrow-function/escaped-async-line-terminator.js b/test/language/expressions/async-arrow-function/escaped-async-line-terminator.js new file mode 100644 index 0000000000000000000000000000000000000000..ee3a7a05474b70aa007115cd213a9fcb29e0b3da --- /dev/null +++ b/test/language/expressions/async-arrow-function/escaped-async-line-terminator.js @@ -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 => {} +}); diff --git a/test/language/expressions/async-generator/generator-created-after-decl-inst.js b/test/language/expressions/async-generator/generator-created-after-decl-inst.js new file mode 100644 index 0000000000000000000000000000000000000000..d492e5ef166b186675ed2afd0d2e98eb9a7e4b40 --- /dev/null +++ b/test/language/expressions/async-generator/generator-created-after-decl-inst.js @@ -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); diff --git a/test/language/expressions/class/class-name-ident-await-escaped-module.js b/test/language/expressions/class/class-name-ident-await-escaped-module.js new file mode 100644 index 0000000000000000000000000000000000000000..8fc155c4baa63aff5cc49ae732c1096b71969ef9 --- /dev/null +++ b/test/language/expressions/class/class-name-ident-await-escaped-module.js @@ -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 {}; diff --git a/test/language/expressions/class/class-name-ident-await-escaped.js b/test/language/expressions/class/class-name-ident-await-escaped.js new file mode 100644 index 0000000000000000000000000000000000000000..b3dd022b492819d1fc0f7b888a4de649d0c804f3 --- /dev/null +++ b/test/language/expressions/class/class-name-ident-await-escaped.js @@ -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 {}; diff --git a/test/language/expressions/class/class-name-ident-await-module.js b/test/language/expressions/class/class-name-ident-await-module.js new file mode 100644 index 0000000000000000000000000000000000000000..e9ba2b59302c134d061872320f87b72d2e64002e --- /dev/null +++ b/test/language/expressions/class/class-name-ident-await-module.js @@ -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 {}; diff --git a/test/language/expressions/class/class-name-ident-await.js b/test/language/expressions/class/class-name-ident-await.js new file mode 100644 index 0000000000000000000000000000000000000000..8fbf07e990ffd9914c7699ec74898218ed8bb785 --- /dev/null +++ b/test/language/expressions/class/class-name-ident-await.js @@ -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 {}; diff --git a/test/language/expressions/class/class-name-ident-let-escaped.js b/test/language/expressions/class/class-name-ident-let-escaped.js new file mode 100644 index 0000000000000000000000000000000000000000..e9beb52c1de1c83edc5f71e10f802d066f5c559c --- /dev/null +++ b/test/language/expressions/class/class-name-ident-let-escaped.js @@ -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 {}; diff --git a/test/language/expressions/class/class-name-ident-let.js b/test/language/expressions/class/class-name-ident-let.js new file mode 100644 index 0000000000000000000000000000000000000000..d08620fde6ccd86065979111bc037807c9d725f9 --- /dev/null +++ b/test/language/expressions/class/class-name-ident-let.js @@ -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 {}; diff --git a/test/language/expressions/class/class-name-ident-static-escaped.js b/test/language/expressions/class/class-name-ident-static-escaped.js new file mode 100644 index 0000000000000000000000000000000000000000..8680e6909b42c6ee51a1034190a2be1932d581c2 --- /dev/null +++ b/test/language/expressions/class/class-name-ident-static-escaped.js @@ -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 {}; diff --git a/test/language/expressions/class/class-name-ident-static.js b/test/language/expressions/class/class-name-ident-static.js new file mode 100644 index 0000000000000000000000000000000000000000..a914e599be540c8b733af0093951c8d172e4ec90 --- /dev/null +++ b/test/language/expressions/class/class-name-ident-static.js @@ -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 {}; diff --git a/test/language/expressions/class/class-name-ident-yield-escaped.js b/test/language/expressions/class/class-name-ident-yield-escaped.js new file mode 100644 index 0000000000000000000000000000000000000000..6adf12d7574b7f80f41373f7ca8eea44569ed387 --- /dev/null +++ b/test/language/expressions/class/class-name-ident-yield-escaped.js @@ -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 {}; diff --git a/test/language/expressions/class/class-name-ident-yield.js b/test/language/expressions/class/class-name-ident-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..ecc3f44dda91bb3015518885863632f4955f4a3e --- /dev/null +++ b/test/language/expressions/class/class-name-ident-yield.js @@ -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 {}; diff --git a/test/language/expressions/generators/generator-created-after-decl-inst.js b/test/language/expressions/generators/generator-created-after-decl-inst.js new file mode 100644 index 0000000000000000000000000000000000000000..c7c198f23399c21e20248011200fe13fd504a2eb --- /dev/null +++ b/test/language/expressions/generators/generator-created-after-decl-inst.js @@ -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); diff --git a/test/language/statements/async-generator/generator-created-after-decl-inst.js b/test/language/statements/async-generator/generator-created-after-decl-inst.js new file mode 100644 index 0000000000000000000000000000000000000000..4ca30a528ec6758ef613ec4f0a4cebba0a12bbe9 --- /dev/null +++ b/test/language/statements/async-generator/generator-created-after-decl-inst.js @@ -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); diff --git a/test/language/statements/class/class-name-ident-await-escaped-module.js b/test/language/statements/class/class-name-ident-await-escaped-module.js new file mode 100644 index 0000000000000000000000000000000000000000..5c1eb1c465c5dc2e59b2eb36e2ee38940d84a9f9 --- /dev/null +++ b/test/language/statements/class/class-name-ident-await-escaped-module.js @@ -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 {} diff --git a/test/language/statements/class/class-name-ident-await-escaped.js b/test/language/statements/class/class-name-ident-await-escaped.js new file mode 100644 index 0000000000000000000000000000000000000000..b1f28aaaac613f8552249061c95d3c3f1d047dea --- /dev/null +++ b/test/language/statements/class/class-name-ident-await-escaped.js @@ -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 {} diff --git a/test/language/statements/class/class-name-ident-await-module.js b/test/language/statements/class/class-name-ident-await-module.js new file mode 100644 index 0000000000000000000000000000000000000000..ec6af342eea1089ae48653dbf36f206ae8267ce2 --- /dev/null +++ b/test/language/statements/class/class-name-ident-await-module.js @@ -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 {} diff --git a/test/language/statements/class/class-name-ident-await.js b/test/language/statements/class/class-name-ident-await.js new file mode 100644 index 0000000000000000000000000000000000000000..0237382e7e4ceaf01e300aa269ac25b0beaba033 --- /dev/null +++ b/test/language/statements/class/class-name-ident-await.js @@ -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 {} diff --git a/test/language/statements/class/class-name-ident-let-escaped.js b/test/language/statements/class/class-name-ident-let-escaped.js new file mode 100644 index 0000000000000000000000000000000000000000..eb54d475299c2310b9466239b71d75c891ad3a8d --- /dev/null +++ b/test/language/statements/class/class-name-ident-let-escaped.js @@ -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 {} diff --git a/test/language/statements/class/class-name-ident-let.js b/test/language/statements/class/class-name-ident-let.js new file mode 100644 index 0000000000000000000000000000000000000000..62da2542afe38b5fe8146245edabc69e1de2b410 --- /dev/null +++ b/test/language/statements/class/class-name-ident-let.js @@ -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 {} diff --git a/test/language/statements/class/class-name-ident-static-escaped.js b/test/language/statements/class/class-name-ident-static-escaped.js new file mode 100644 index 0000000000000000000000000000000000000000..fe1e1e7960e786003c2cf48077229bf8f4e51606 --- /dev/null +++ b/test/language/statements/class/class-name-ident-static-escaped.js @@ -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 {} diff --git a/test/language/statements/class/class-name-ident-static.js b/test/language/statements/class/class-name-ident-static.js new file mode 100644 index 0000000000000000000000000000000000000000..43b7c9ca9b9fc6796cdaee32e387ec651a61240c --- /dev/null +++ b/test/language/statements/class/class-name-ident-static.js @@ -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 {} diff --git a/test/language/statements/class/class-name-ident-yield-escaped.js b/test/language/statements/class/class-name-ident-yield-escaped.js new file mode 100644 index 0000000000000000000000000000000000000000..e2992b51d30726b41b0d5c8c5449e2b203e8b3a2 --- /dev/null +++ b/test/language/statements/class/class-name-ident-yield-escaped.js @@ -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 {} diff --git a/test/language/statements/class/class-name-ident-yield.js b/test/language/statements/class/class-name-ident-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..6ef516599299cf60aa2e966b1a58aabca6f6cad6 --- /dev/null +++ b/test/language/statements/class/class-name-ident-yield.js @@ -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 {} diff --git a/test/language/statements/generators/generator-created-after-decl-inst.js b/test/language/statements/generators/generator-created-after-decl-inst.js new file mode 100644 index 0000000000000000000000000000000000000000..a0f49f9790bb7d33cd0924f9bbc04299884bde77 --- /dev/null +++ b/test/language/statements/generators/generator-created-after-decl-inst.js @@ -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); diff --git a/test/language/statements/try/early-catch-function.js b/test/language/statements/try/early-catch-function.js new file mode 100644 index 0000000000000000000000000000000000000000..f51c16701a2fdf33128d331ba87f890eeb8eaec5 --- /dev/null +++ b/test/language/statements/try/early-catch-function.js @@ -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(){} + } +}