diff --git a/features.txt b/features.txt index 1cf8f2ac43de5f5db1ae3557cd1e775415f04bc5..63bd7d329280efadcbea6f08b75be3c806fde2d2 100644 --- a/features.txt +++ b/features.txt @@ -30,6 +30,10 @@ class-static-methods-private # https://github.com/tc39/proposal-private-methods class-methods-private +# Dynamic Import +# https://github.com/tc39/proposal-dynamic-import +dynamic-import + # Promise.prototype.finally # https://github.com/tc39/proposal-promise-finally Promise.prototype.finally @@ -99,6 +103,10 @@ Symbol.prototype.description # https://github.com/tc39/proposal-json-superset json-superset +# Well-formed JSON.stringify +# https://github.com/tc39/proposal-well-formed-stringify +well-formed-json-stringify + # Intl.ListFormat # https://github.com/tc39/proposal-intl-list-format Intl.ListFormat diff --git a/implementation-contributed/curation_logs/javascriptcore.json b/implementation-contributed/curation_logs/javascriptcore.json index c89cc822a35f416f53f95e1b8e7a1636b3354202..8b0a06e3dadf2cb98dc473608589aaf840227a17 100644 --- a/implementation-contributed/curation_logs/javascriptcore.json +++ b/implementation-contributed/curation_logs/javascriptcore.json @@ -1,6 +1,6 @@ { - "sourceRevisionAtLastExport": "f2e2ad6325", - "targetRevisionAtLastExport": "f4f5a415f", + "sourceRevisionAtLastExport": "3a8f232444", + "targetRevisionAtLastExport": "0e9545be99", "curatedFiles": { "/stress/Number-isNaN-basics.js": "DELETED_IN_TARGET", "/stress/Object_static_methods_Object.getOwnPropertyDescriptors-proxy.js": "DELETED_IN_TARGET", diff --git a/implementation-contributed/curation_logs/v8.json b/implementation-contributed/curation_logs/v8.json index bbc1daeb5f27c7461061564e6b27236097b62aec..d3e6cec9eb08f13b8290c74fe7c69181b6380138 100644 --- a/implementation-contributed/curation_logs/v8.json +++ b/implementation-contributed/curation_logs/v8.json @@ -1,5 +1,5 @@ { - "sourceRevisionAtLastExport": "d2e0166d", - "targetRevisionAtLastExport": "67c244b69", + "sourceRevisionAtLastExport": "466306e9", + "targetRevisionAtLastExport": "4bc81c1dc2", "curatedFiles": {} } \ No newline at end of file diff --git a/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-general.js b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-general.js new file mode 100644 index 0000000000000000000000000000000000000000..56e798e5006dbebc86d979fdbfdfbbbf817d479a --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-general.js @@ -0,0 +1,97 @@ +//@ runBigIntEnabled + +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +function assert(a) { + if (!a) + throw new Error("Bad assertion"); +} + +assert.sameValue = function (input, expected, message) { + if (input !== expected) + throw new Error(message); +} + +assert.sameValue(0b00n & 0b00n, 0b00n, "0b00n & 0b00n === 0b00n"); +assert.sameValue(0b00n & 0b01n, 0b00n, "0b00n & 0b01n === 0b00n"); +assert.sameValue(0b01n & 0b00n, 0b00n, "0b01n & 0b00n === 0b00n"); +assert.sameValue(0b00n & 0b10n, 0b00n, "0b00n & 0b10n === 0b00n"); +assert.sameValue(0b10n & 0b00n, 0b00n, "0b10n & 0b00n === 0b00n"); +assert.sameValue(0b00n & 0b11n, 0b00n, "0b00n & 0b11n === 0b00n"); +assert.sameValue(0b11n & 0b00n, 0b00n, "0b11n & 0b00n === 0b00n"); +assert.sameValue(0b01n & 0b01n, 0b01n, "0b01n & 0b01n === 0b01n"); +assert.sameValue(0b01n & 0b10n, 0b00n, "0b01n & 0b10n === 0b00n"); +assert.sameValue(0b10n & 0b01n, 0b00n, "0b10n & 0b01n === 0b00n"); +assert.sameValue(0b01n & 0b11n, 0b01n, "0b01n & 0b11n === 0b01n"); +assert.sameValue(0b11n & 0b01n, 0b01n, "0b11n & 0b01n === 0b01n"); +assert.sameValue(0b10n & 0b10n, 0b10n, "0b10n & 0b10n === 0b10n"); +assert.sameValue(0b10n & 0b11n, 0b10n, "0b10n & 0b11n === 0b10n"); +assert.sameValue(0b11n & 0b10n, 0b10n, "0b11n & 0b10n === 0b10n"); +assert.sameValue(0xffffffffn & 0n, 0n, "0xffffffffn & 0n === 0n"); +assert.sameValue(0n & 0xffffffffn, 0n, "0n & 0xffffffffn === 0n"); +assert.sameValue(0xffffffffn & 0xffffffffn, 0xffffffffn, "0xffffffffn & 0xffffffffn === 0xffffffffn"); +assert.sameValue(0xffffffffffffffffn & 0n, 0n, "0xffffffffffffffffn & 0n === 0n"); +assert.sameValue(0n & 0xffffffffffffffffn, 0n, "0n & 0xffffffffffffffffn === 0n"); +assert.sameValue(0xffffffffffffffffn & 0xffffffffn, 0xffffffffn, "0xffffffffffffffffn & 0xffffffffn === 0xffffffffn"); +assert.sameValue(0xffffffffn & 0xffffffffffffffffn, 0xffffffffn, "0xffffffffn & 0xffffffffffffffffn === 0xffffffffn"); +assert.sameValue( + 0xffffffffffffffffn & 0xffffffffffffffffn, 0xffffffffffffffffn, + "0xffffffffffffffffn & 0xffffffffffffffffn === 0xffffffffffffffffn"); +assert.sameValue( + 0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n, 0x42092803008e813400181700n, + "0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n === 0x42092803008e813400181700n"); +assert.sameValue( + 0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n, 0x42092803008e813400181700n, + "0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n === 0x42092803008e813400181700n"); +assert.sameValue(0n & -1n, 0n, "0n & -1n === 0n"); +assert.sameValue(-1n & 0n, 0n, "-1n & 0n === 0n"); +assert.sameValue(0n & -2n, 0n, "0n & -2n === 0n"); +assert.sameValue(-2n & 0n, 0n, "-2n & 0n === 0n"); +assert.sameValue(1n & -2n, 0n, "1n & -2n === 0n"); +assert.sameValue(-2n & 1n, 0n, "-2n & 1n === 0n"); +assert.sameValue(2n & -2n, 2n, "2n & -2n === 2n"); +assert.sameValue(-2n & 2n, 2n, "-2n & 2n === 2n"); +assert.sameValue(2n & -3n, 0n, "2n & -3n === 0n"); +assert.sameValue(-3n & 2n, 0n, "-3n & 2n === 0n"); +assert.sameValue(-1n & -2n, -2n, "-1n & -2n === -2n"); +assert.sameValue(-2n & -1n, -2n, "-2n & -1n === -2n"); +assert.sameValue(-2n & -2n, -2n, "-2n & -2n === -2n"); +assert.sameValue(-2n & -3n, -4n, "-2n & -3n === -4n"); +assert.sameValue(-3n & -2n, -4n, "-3n & -2n === -4n"); +assert.sameValue(0xffffffffn & -1n, 0xffffffffn, "0xffffffffn & -1n === 0xffffffffn"); +assert.sameValue(-1n & 0xffffffffn, 0xffffffffn, "-1n & 0xffffffffn === 0xffffffffn"); +assert.sameValue(0xffffffffffffffffn & -1n, 0xffffffffffffffffn, "0xffffffffffffffffn & -1n === 0xffffffffffffffffn"); +assert.sameValue(-1n & 0xffffffffffffffffn, 0xffffffffffffffffn, "-1n & 0xffffffffffffffffn === 0xffffffffffffffffn"); +assert.sameValue( + 0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n, 0xbf2ed51fb554100cd330000ac6004080n, + "0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n === 0xbf2ed51fb554100cd330000ac6004080n"); +assert.sameValue( + -0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n, 0xbf2ed51fb554100cd330000ac6004080n, + "-0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n === 0xbf2ed51fb554100cd330000ac6004080n"); +assert.sameValue( + -0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n, 0x8a2c72024405ec138670800n, + "-0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n === 0x8a2c72024405ec138670800n"); +assert.sameValue( + 0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n, 0x8a2c72024405ec138670800n, + "0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n === 0x8a2c72024405ec138670800n"); +assert.sameValue( + -0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n, -0xbf2ed51fffffff2ff7fedffffe7f5f80n, + "-0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n === -0xbf2ed51fffffff2ff7fedffffe7f5f80n"); +assert.sameValue( + -0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n, -0xbf2ed51fffffff2ff7fedffffe7f5f80n, + "-0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n === -0xbf2ed51fffffff2ff7fedffffe7f5f80n"); +assert.sameValue(-0xffffffffn & 0n, 0n, "-0xffffffffn & 0n === 0n"); +assert.sameValue(0n & -0xffffffffn, 0n, "0n & -0xffffffffn === 0n"); +assert.sameValue( + -0xffffffffffffffffn & 0x10000000000000000n, 0x10000000000000000n, + "-0xffffffffffffffffn & 0x10000000000000000n === 0x10000000000000000n"); +assert.sameValue( + 0x10000000000000000n & -0xffffffffffffffffn, 0x10000000000000000n, + "0x10000000000000000n & -0xffffffffffffffffn === 0x10000000000000000n"); +assert.sameValue( + -0xffffffffffffffffffffffffn & 0x10000000000000000n, 0n, + "-0xffffffffffffffffffffffffn & 0x10000000000000000n === 0n"); +assert.sameValue( + 0x10000000000000000n & -0xffffffffffffffffffffffffn, 0n, + "0x10000000000000000n & -0xffffffffffffffffffffffffn === 0n"); diff --git a/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-jit.js b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-jit.js new file mode 100644 index 0000000000000000000000000000000000000000..ee766aff6175ddf521b9eace01181bc836fdee8a --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-jit.js @@ -0,0 +1,20 @@ +//@ runBigIntEnabled + +let assert = { + sameValue: function(i, e, m) { + if (i !== e) + throw new Error(m); + } +} + +function bigIntBitAnd(a, b) { + return (a & b) & (a & 0b11n); + +} +noInline(bigIntBitAnd); + +for (let i = 0; i < 10000; i++) { + let r = bigIntBitAnd(0b11n, 0b1010n); + assert.sameValue(r, 0b10n, 0b11n + " & " + 0b1010n + " = " + r); +} + diff --git a/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-memory-stress.js b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-memory-stress.js new file mode 100644 index 0000000000000000000000000000000000000000..61e7ae3b9c91c790d93bff3d458b5141f0a9454c --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-memory-stress.js @@ -0,0 +1,14 @@ +//@ runBigIntEnabled + +function assert(a) { + if (!a) + throw new Error("Bad assertion"); +} + +let a = 0b11n; +for (let i = 0; i < 1000000; i++) { + a &= 0b01n; +} + +assert(a === 0b01n); + diff --git a/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-to-primitive-precedence.js b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-to-primitive-precedence.js new file mode 100644 index 0000000000000000000000000000000000000000..bfa8e161fdf41798aef166475bedc1182a475977 --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-to-primitive-precedence.js @@ -0,0 +1,29 @@ +//@ runBigIntEnabled + +assert = { + sameValue: function (input, expected, message) { + if (input !== expected) + throw new Error(message); + } +}; + +let o = { + [Symbol.toPrimitive]: function() { + throw new Error("Bad"); + } +}; + +try{ + o & Symbol("2"); + assert.sameValue(true, false, "Exception expected to be throwed, but executed without error"); +} catch (e) { + assert.sameValue(e.message, "Bad", "Expected to throw Error('Bad'), but got: " + e); +} + +try{ + Symbol("2") & o; + assert.sameValue(true, false, "Exception expected to be throwed, but executed without error"); +} catch (e) { + assert.sameValue(e instanceof TypeError, true, "Expected to throw TypeError, but got: " + e) +} + diff --git a/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-type-error.js b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-type-error.js new file mode 100644 index 0000000000000000000000000000000000000000..dcb7768bac7beb1aec5b2769b76011ee41da5d1d --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-type-error.js @@ -0,0 +1,106 @@ +//@ runBigIntEnabled + +function assert(a, message) { + if (!a) + throw new Error(message); +} + +function assertThrowTypeError(a, b, message) { + try { + let n = a & b; + assert(false, message + ": Should throw TypeError, but executed without exception"); + } catch (e) { + assert(e instanceof TypeError, message + ": expected TypeError, got: " + e); + } +} + +assertThrowTypeError(30n, "foo", "BigInt & String"); +assertThrowTypeError("bar", 18757382984821n, "String & BigInt"); +assertThrowTypeError(30n, Symbol("foo"), "BigInt & Symbol"); +assertThrowTypeError(Symbol("bar"), 18757382984821n, "Symbol & BigInt"); +assertThrowTypeError(30n, 3320, "BigInt & Int32"); +assertThrowTypeError(33256, 18757382984821n, "Int32 & BigInt"); +assertThrowTypeError(30n, 0.543, "BigInt & Double"); +assertThrowTypeError(230.19293, 18757382984821n, "Double & BigInt"); +assertThrowTypeError(30n, NaN, "BigInt & NaN"); +assertThrowTypeError(NaN, 18757382984821n, "NaN & BigInt"); +assertThrowTypeError(30n, NaN, "BigInt & NaN"); +assertThrowTypeError(NaN, 18757382984821n, "NaN & BigInt"); +assertThrowTypeError(30n, +Infinity, "BigInt & NaN"); +assertThrowTypeError(+Infinity, 18757382984821n, "NaN & BigInt"); +assertThrowTypeError(30n, -Infinity, "BigInt & -Infinity"); +assertThrowTypeError(-Infinity, 18757382984821n, "-Infinity & BigInt"); +assertThrowTypeError(30n, null, "BigInt & null"); +assertThrowTypeError(null, 18757382984821n, "null & BigInt"); +assertThrowTypeError(30n, undefined, "BigInt & undefined"); +assertThrowTypeError(undefined, 18757382984821n, "undefined & BigInt"); +assertThrowTypeError(30n, true, "BigInt & true"); +assertThrowTypeError(true, 18757382984821n, "true & BigInt"); +assertThrowTypeError(30n, false, "BigInt & false"); +assertThrowTypeError(false, 18757382984821n, "false & BigInt"); + +// Error when returning from object + +let o = { + valueOf: function () { return Symbol("Foo"); } +}; + +assertThrowTypeError(30n, o, "BigInt & Object.valueOf returning Symbol"); +assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Symbol & BigInt"); + +o = { + valueOf: function () { return 33256; } +}; + +assertThrowTypeError(30n, o, "BigInt & Object.valueOf returning Int32"); +assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Int32 & BigInt"); + +o = { + valueOf: function () { return 0.453; } +}; + +assertThrowTypeError(30n, o, "BigInt & Object.valueOf returning Double"); +assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Double & BigInt"); + +o = { + toString: function () { return Symbol("Foo"); } +}; + +assertThrowTypeError(30n, o, "BigInt & Object.toString returning Symbol"); +assertThrowTypeError(o, 18757382984821n, "Object.toString returning Symbol & BigInt"); + +o = { + toString: function () { return 33256; } +}; + +assertThrowTypeError(30n, o, "BigInt & Object.toString returning Int32"); +assertThrowTypeError(o, 18757382984821n, "Object.toString returning Int32 & BigInt"); + +o = { + toString: function () { return 0.453; } +}; + +assertThrowTypeError(30n, o, "BigInt & Object.toString returning Double"); +assertThrowTypeError(o, 18757382984821n, "Object.toString returning Double & BigInt"); + +o = { + [Symbol.toPrimitive]: function () { return Symbol("Foo"); } +}; + +assertThrowTypeError(30n, o, "BigInt & Object.@@toPrimitive returning Symbol"); +assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Symbol & BigInt"); + +o = { + [Symbol.toPrimitive]: function () { return 33256; } +}; + +assertThrowTypeError(30n, o, "BigInt & Object.@@toPrimitive returning Int32"); +assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Int32 & BigInt"); + +o = { + [Symbol.toPrimitive]: function () { return 0.453; } +}; + +assertThrowTypeError(30n, o, "BigInt & Object.@@toPrimitive returning Double"); +assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Double & BigInt"); + diff --git a/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-wrapped-value.js b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-wrapped-value.js new file mode 100644 index 0000000000000000000000000000000000000000..c4377f41abd357f2079267ccb52848747d720653 --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/big-int-bitwise-and-wrapped-value.js @@ -0,0 +1,37 @@ +//@ runBigIntEnabled + +assert = { + sameValue: function (input, expected, message) { + if (input !== expected) + throw new Error(message); + } +}; + +function testBitAnd(x, y, z, message) { + assert.sameValue(x & y, z, message); + assert.sameValue(y & x, z, message); +} + +testBitAnd(Object(0b10n), 0b01n, 0b00n, "ToPrimitive: unbox object with internal slot"); + +let o = { + [Symbol.toPrimitive]: function() { + return 0b10n; + } +}; +testBitAnd(o, 0b01n, 0b00n, "ToPrimitive: @@toPrimitive"); + +o = { + valueOf: function() { + return 0b10n; + } +}; +testBitAnd(o, 0b01n, 0b00n, "ToPrimitive: valueOf"); + +o = { + toString: function() { + return 0b10n; + } +} +testBitAnd(o, 0b01n, 0b00n, "ToPrimitive: toString"); + diff --git a/implementation-contributed/javascriptcore/stress/big-int-to-string.js b/implementation-contributed/javascriptcore/stress/big-int-to-string.js new file mode 100644 index 0000000000000000000000000000000000000000..d6851c951bddbf218414a339e2aa61090acc6681 --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/big-int-to-string.js @@ -0,0 +1,57 @@ +//@ runBigIntEnabled + +function assert(a) { + if (!a) + throw new Error("Bad assertion"); +} + +let v = 10n; +assert(v.toString() === "10"); +assert(v.toString(2) === "1010"); +assert(v.toString(3) === "101"); +assert(v.toString(8) === "12"); +assert(v.toString(16) === "a"); +assert(v.toString(32) === "a"); + +v = 191561942608236107294793378393788647952342390272950271n; +assert(v.toString() === "191561942608236107294793378393788647952342390272950271"); +assert(v.toString(2) === "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"); +assert(v.toString(3) === "2002122121011101220102010210020102000210011100122221002112102021022221102202020101221000021200201121121100121121"); +assert(v.toString(8) === "77777777777777777777777777777777777777777777777777777777777"); +assert(v.toString(16) === "1ffffffffffffffffffffffffffffffffffffffffffff"); +assert(v.toString(32) === "3vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"); + +v = -10n; +assert(v.toString() === "-10"); +assert(v.toString(2) === "-1010"); +assert(v.toString(3) === "-101"); +assert(v.toString(8) === "-12"); +assert(v.toString(16) === "-a"); +assert(v.toString(32) === "-a"); + +v = -191561942608236107294793378393788647952342390272950271n; +assert(v.toString() === "-191561942608236107294793378393788647952342390272950271"); +assert(v.toString(2) === "-111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"); +assert(v.toString(3) === "-2002122121011101220102010210020102000210011100122221002112102021022221102202020101221000021200201121121100121121"); +assert(v.toString(8) === "-77777777777777777777777777777777777777777777777777777777777"); +assert(v.toString(16) === "-1ffffffffffffffffffffffffffffffffffffffffffff"); +assert(v.toString(32) === "-3vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"); + +// Invaid radix + +function testInvalidRadix(radix) { + try { + v.toString(radix); + assert(false); + } catch(e) { + assert(e instanceof RangeError); + } +} + +testInvalidRadix(-10); +testInvalidRadix(-1); +testInvalidRadix(0); +testInvalidRadix(1); +testInvalidRadix(37); +testInvalidRadix(4294967312); + diff --git a/implementation-contributed/javascriptcore/stress/dataview-jit-set-nan.js b/implementation-contributed/javascriptcore/stress/dataview-jit-set-nan.js new file mode 100644 index 0000000000000000000000000000000000000000..cbd1cdb3afe179c0339fe0da29aefe5b6765af30 --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/dataview-jit-set-nan.js @@ -0,0 +1,52 @@ +//@ skip if $architecture == "mips" + +"use strict"; + +function assert(b) { + if (!b) + throw new Error; +} + +function test() { + function storeLittleEndian(dv, index, value) { + dv.setFloat32(index, value, true); + } + noInline(storeLittleEndian); + + function storeBigEndian(dv, index, value) { + dv.setFloat32(index, value, false); + } + noInline(storeBigEndian); + + function store(dv, index, value, littleEndian) { + dv.setFloat32(index, value, littleEndian); + } + noInline(store); + + let buffer = new ArrayBuffer(4); + let arr = new Float32Array(buffer); + let bits = new Uint32Array(buffer); + let dv = new DataView(buffer); + + for (let i = 0; i < 10000; ++i) { + storeLittleEndian(dv, 0, 1.5); + assert(arr[0] === 1.5); + + storeLittleEndian(dv, 0, 12912.124123215122); + assert(arr[0] === 12912.1240234375); + assert(bits[0] === 0x4649c07f); + + storeLittleEndian(dv, 0, NaN); + assert(isNaN(arr[0])); + assert(bits[0] === 0x7FC00000); + + storeLittleEndian(dv, 0, 2.3879393e-38); + assert(arr[0] === 2.387939260590663e-38); + assert(bits[0] === 0x01020304); + + storeBigEndian(dv, 0, 2.3879393e-38); + assert(arr[0] === 1.539989614439558e-36); + assert(bits[0] === 0x04030201); + } +} +test(); \ No newline at end of file diff --git a/implementation-contributed/javascriptcore/stress/dataview-jit-set.js b/implementation-contributed/javascriptcore/stress/dataview-jit-set.js new file mode 100644 index 0000000000000000000000000000000000000000..9238eb73f91dd0649e9b7f8b16212d88c7f462ca --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/dataview-jit-set.js @@ -0,0 +1,439 @@ +"use strict"; + +function assert(b) { + if (!b) + throw new Error; +} + +function readHex(dv, bytes) { + function isLittleEndian() { + let b = new ArrayBuffer(4); + let dv = new DataView(b); + dv.setInt32(0, 0x00112233, true); + return dv.getUint8(0) === 0x33; + } + let str = ""; + function readByte(i) { + let b = dv.getUint8(i).toString(16); + if (b.length === 1) + b = "0" + b; + else + assert(b.length === 2) + return b; + } + if (isLittleEndian()) { + for (let i = bytes; i--;) + str = str + readByte(i); + } else { + for (let i = 0; i < bytes; ++i) + str = str + readByte(i); + } + + return "0x" + str; +} + +{ + let b = new ArrayBuffer(4); + let dv = new DataView(b); + dv.setInt32(0, 0x00112233, true); + assert(readHex(dv, 4) === "0x00112233"); +} + +function test() { + function storeLittleEndian(dv, index, value) { + dv.setInt16(index, value, true); + } + noInline(storeLittleEndian); + + function storeBigEndian(dv, index, value) { + dv.setInt16(index, value, false); + } + noInline(storeBigEndian); + + function store(dv, index, value, littleEndian) { + dv.setInt16(index, value, littleEndian); + } + noInline(store); + + let buffer = new ArrayBuffer(2); + let arr = new Uint16Array(buffer); + let dv = new DataView(buffer); + + for (let i = 0; i < 10000; ++i) { + storeLittleEndian(dv, 0, 0xfaba); + assert(arr[0] === 0xfaba); + + store(dv, 0, 0xabcd, true); + assert(arr[0] === 0xabcd); + + store(dv, 0, 0xbadbeef, true); + assert(arr[0] === 0xbeef); + + storeLittleEndian(dv, 0, 0xbb4db33f, true); + assert(arr[0] === 0xb33f); + + storeBigEndian(dv, 0, 0xfada); + assert(arr[0] === 0xdafa); + + storeBigEndian(dv, 0, 0x12ab); + assert(arr[0] === 0xab12); + + store(dv, 0, 0x1234, false); + assert(arr[0] === 0x3412); + + store(dv, 0, 0x0102, false); + assert(arr[0] === 0x0201); + + store(dv, 0, -1, false); + assert(arr[0] === 0xffff); + + store(dv, 0, -2, false); + assert(arr[0] === 0xfeff); + + storeBigEndian(dv, 0, -1); + assert(arr[0] === 0xffff); + + storeBigEndian(dv, 0, -2); + assert(arr[0] === 0xfeff); + + storeBigEndian(dv, 0, -2147483648); + assert(arr[0] === 0x0000); + + storeLittleEndian(dv, 0, -2147483648); + assert(arr[0] === 0x0000); + + storeLittleEndian(dv, 0, -2147478988); + assert(arr[0] === 0x1234); + + storeBigEndian(dv, 0, -2147478988); + assert(arr[0] === 0x3412); + } +} +test(); + +function test2() { + function storeLittleEndian(dv, index, value) { + dv.setUint16(index, value, true); + } + noInline(storeLittleEndian); + + function storeBigEndian(dv, index, value) { + dv.setUint16(index, value, false); + } + noInline(storeBigEndian); + + function store(dv, index, value, littleEndian) { + dv.setUint16(index, value, littleEndian); + } + noInline(store); + + let buffer = new ArrayBuffer(2); + let arr = new Uint16Array(buffer); + let dv = new DataView(buffer); + + for (let i = 0; i < 10000; ++i) { + storeLittleEndian(dv, 0, 0xfaba); + assert(arr[0] === 0xfaba); + + store(dv, 0, 0xabcd, true); + assert(arr[0] === 0xabcd); + + store(dv, 0, 0xbadbeef, true); + assert(arr[0] === 0xbeef); + + storeLittleEndian(dv, 0, 0xbb4db33f, true); + assert(arr[0] === 0xb33f); + + storeBigEndian(dv, 0, 0xfada); + assert(arr[0] === 0xdafa); + + storeBigEndian(dv, 0, 0x12ab); + assert(arr[0] === 0xab12); + + store(dv, 0, 0x1234, false); + assert(arr[0] === 0x3412); + + store(dv, 0, 0x0102, false); + assert(arr[0] === 0x0201); + + store(dv, 0, -1, false); + assert(arr[0] === 0xffff); + + store(dv, 0, -2, false); + assert(arr[0] === 0xfeff); + + storeBigEndian(dv, 0, -1); + assert(arr[0] === 0xffff); + + storeBigEndian(dv, 0, -2); + assert(arr[0] === 0xfeff); + + storeBigEndian(dv, 0, -2147483648); + assert(arr[0] === 0x0000); + + storeLittleEndian(dv, 0, -2147483648); + assert(arr[0] === 0x0000); + + storeLittleEndian(dv, 0, -2147478988); + assert(arr[0] === 0x1234); + + storeBigEndian(dv, 0, -2147478988); + assert(arr[0] === 0x3412); + } +} +test2(); + +function test3() { + function storeLittleEndian(dv, index, value) { + dv.setUint32(index, value, true); + } + noInline(storeLittleEndian); + + function storeBigEndian(dv, index, value) { + dv.setUint32(index, value, false); + } + noInline(storeBigEndian); + + function store(dv, index, value, littleEndian) { + dv.setUint32(index, value, littleEndian); + } + noInline(store); + + let buffer = new ArrayBuffer(4); + let arr = new Uint32Array(buffer); + let arr2 = new Int32Array(buffer); + let dv = new DataView(buffer); + + for (let i = 0; i < 10000; ++i) { + storeLittleEndian(dv, 0, 0xffffffff); + assert(arr[0] === 0xffffffff); + assert(arr2[0] === -1); + + storeLittleEndian(dv, 0, 0xffaabbcc); + assert(arr[0] === 0xffaabbcc); + + storeBigEndian(dv, 0, 0x12345678); + assert(arr[0] === 0x78563412); + + storeBigEndian(dv, 0, 0xffaabbcc); + assert(arr[0] === 0xccbbaaff); + + store(dv, 0, 0xfaeadaca, false); + assert(arr[0] === 0xcadaeafa); + + store(dv, 0, 0xcadaeafa, false); + assert(arr2[0] === -85271862); + + store(dv, 0, 0x12345678, false); + assert(arr[0] === 0x78563412); + + storeBigEndian(dv, 0, 0xbeeffeeb); + assert(arr2[0] === -335614018); + } +} +test3(); + +function test4() { + function storeLittleEndian(dv, index, value) { + dv.setInt32(index, value, true); + } + noInline(storeLittleEndian); + + function storeBigEndian(dv, index, value) { + dv.setInt32(index, value, false); + } + noInline(storeBigEndian); + + function store(dv, index, value, littleEndian) { + dv.setInt32(index, value, littleEndian); + } + noInline(store); + + let buffer = new ArrayBuffer(4); + let arr = new Uint32Array(buffer); + let arr2 = new Int32Array(buffer); + let dv = new DataView(buffer); + + for (let i = 0; i < 10000; ++i) { + storeLittleEndian(dv, 0, 0xffffffff); + assert(arr[0] === 0xffffffff); + assert(arr2[0] === -1); + + storeLittleEndian(dv, 0, 0xffaabbcc); + assert(arr[0] === 0xffaabbcc); + + storeBigEndian(dv, 0, 0x12345678); + assert(arr[0] === 0x78563412); + + storeBigEndian(dv, 0, 0xffaabbcc); + assert(arr[0] === 0xccbbaaff); + + store(dv, 0, 0xfaeadaca, false); + assert(arr[0] === 0xcadaeafa); + + store(dv, 0, 0xcadaeafa, false); + assert(arr2[0] === -85271862); + + store(dv, 0, 0x12345678, false); + assert(arr[0] === 0x78563412); + + storeBigEndian(dv, 0, 0xbeeffeeb); + assert(arr2[0] === -335614018); + } +} +test4(); + +function test5() { + function storeLittleEndian(dv, index, value) { + dv.setFloat32(index, value, true); + } + noInline(storeLittleEndian); + + function storeBigEndian(dv, index, value) { + dv.setFloat32(index, value, false); + } + noInline(storeBigEndian); + + function store(dv, index, value, littleEndian) { + dv.setFloat32(index, value, littleEndian); + } + noInline(store); + + let buffer = new ArrayBuffer(4); + let arr = new Float32Array(buffer); + let bits = new Uint32Array(buffer); + let dv = new DataView(buffer); + + for (let i = 0; i < 10000; ++i) { + storeLittleEndian(dv, 0, 1.5); + assert(arr[0] === 1.5); + + storeLittleEndian(dv, 0, 12912.124123215122); + assert(arr[0] === 12912.1240234375); + assert(bits[0] === 0x4649c07f); + + storeLittleEndian(dv, 0, NaN); + assert(isNaN(arr[0])); + + storeLittleEndian(dv, 0, 2.3879393e-38); + assert(arr[0] === 2.387939260590663e-38); + assert(bits[0] === 0x01020304); + + storeBigEndian(dv, 0, 2.3879393e-38); + assert(arr[0] === 1.539989614439558e-36); + assert(bits[0] === 0x04030201); + } +} +test5(); + +function test6() { + function storeLittleEndian(dv, index, value) { + dv.setFloat64(index, value, true); + } + noInline(storeLittleEndian); + + function storeBigEndian(dv, index, value) { + dv.setFloat64(index, value, false); + } + noInline(storeBigEndian); + + function store(dv, index, value, littleEndian) { + dv.setFloat64(index, value, littleEndian); + } + noInline(store); + + let buffer = new ArrayBuffer(8); + let arr = new Float64Array(buffer); + let dv = new DataView(buffer); + + for (let i = 0; i < 10000; ++i) { + storeLittleEndian(dv, 0, NaN); + assert(isNaN(arr[0])); + + storeLittleEndian(dv, 0, -2.5075187084135162e+284); + assert(arr[0] === -2.5075187084135162e+284); + assert(readHex(dv, 8) === "0xfafafafafafafafa"); + + store(dv, 0, 124.553, true); + assert(readHex(dv, 8) === "0x405f23645a1cac08"); + + store(dv, 0, Infinity, true); + assert(readHex(dv, 8) === "0x7ff0000000000000"); + + store(dv, 0, Infinity, false); + assert(readHex(dv, 8) === "0x000000000000f07f"); + + store(dv, 0, -Infinity, true); + assert(readHex(dv, 8) === "0xfff0000000000000"); + + storeBigEndian(dv, 0, -2.5075187084135162e+284); + assert(arr[0] === -2.5075187084135162e+284); + assert(readHex(dv, 8) === "0xfafafafafafafafa"); + + storeBigEndian(dv, 0, 124.553); + assert(readHex(dv, 8) === "0x08ac1c5a64235f40"); + } +} +test6(); + +function test7() { + function store(dv, index, value) { + dv.setInt8(index, value); + } + noInline(store); + + let buffer = new ArrayBuffer(1); + let arr = new Uint8Array(buffer); + let arr2 = new Int8Array(buffer); + let dv = new DataView(buffer); + + for (let i = 0; i < 10000; ++i) { + store(dv, 0, 0xff); + assert(arr[0] === 0xff); + assert(arr2[0] === -1); + + store(dv, 0, 0xff00); + assert(arr[0] === 0); + assert(arr2[0] === 0); + + store(dv, 0, -1); + assert(arr[0] === 0xff); + assert(arr2[0] === -1); + + store(dv, 0, 0x0badbeef); + assert(arr[0] === 0xef); + assert(arr2[0] === -17); + } +} +test7(); + +function test8() { + function store(dv, index, value) { + dv.setInt8(index, value); + } + noInline(store); + + let buffer = new ArrayBuffer(1); + let arr = new Uint8Array(buffer); + let arr2 = new Int8Array(buffer); + let dv = new DataView(buffer); + + for (let i = 0; i < 10000; ++i) { + store(dv, 0, 0xff); + assert(arr[0] === 0xff); + assert(arr2[0] === -1); + + store(dv, 0, 0xff00); + assert(arr[0] === 0); + assert(arr2[0] === 0); + + store(dv, 0, -1); + assert(arr[0] === 0xff); + assert(arr2[0] === -1); + + store(dv, 0, 0x0badbeef); + assert(arr[0] === 0xef); + assert(arr2[0] === -17); + } +} +test8(); diff --git a/implementation-contributed/javascriptcore/stress/ftl-should-always-filter-for-low-type-check-functions.js b/implementation-contributed/javascriptcore/stress/ftl-should-always-filter-for-low-type-check-functions.js new file mode 100644 index 0000000000000000000000000000000000000000..0a1f4f3e093de3aeabc4e2f7738ac7413ff7ad62 --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/ftl-should-always-filter-for-low-type-check-functions.js @@ -0,0 +1,31 @@ +//@ runDefault("--useConcurrentJIT=0", "--jitPolicyScale=0", "--maximumInliningDepth=2") + +function foo(x, y) { + var w = 0; + for (var i = 0; i < x.length; ++i) { + for (var j = 0; j < x.length; ++j) + w += foo(j, i); + y[i] = w; + } +} + +function test(x, a3) { + a1 = []; + a2 = []; + + for (i = 0; i < x; ++i) + a1[i] = 0; + + for (i = 0; i < 10; ++i) { + foo(a3, a2); + foo(a3, a1); + } +} +noDFG(test); + +a3 = []; +for (var i = 0; i < 3; ++i) + a3[i] = 0; + +for (var i = 3; i <= 12; i *= 2) + test(i, a3); diff --git a/implementation-contributed/javascriptcore/stress/jsc-read.js b/implementation-contributed/javascriptcore/stress/jsc-read.js new file mode 100644 index 0000000000000000000000000000000000000000..85d476ab0ca464528e5e8f3e1d3822e1999fdc5d --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/jsc-read.js @@ -0,0 +1,38 @@ +(function test() { + // Read this test file using jsc shell's builtins, and check that its content is as expected. + const in_file = 'jsc-read.js'; + + const check = content_read => { + let testContent = test.toString(); + let lineEnding = testContent.match(/\r?\n/)[0]; + let expect = `(${testContent})();${lineEnding}`; + if (content_read !== expect) + throw Error('Expected to read this file as-is, instead read:\n==========\n' + content_read + '\n=========='); + }; + + const test_arraybuffer = read_function => { + let file = read_function(in_file, 'binary'); + if (typeof file.buffer !== 'object' || file.byteLength === undefined || file.length === undefined || file.BYTES_PER_ELEMENT !== 1 || file.byteOffset !== 0) + throw Error('Expected a Uint8Array'); + let str = ''; + for (var i = 0; i != file.length; ++i) + str += String.fromCharCode(file[i]); // Assume ASCII. + check(str); + }; + + const test_string = read_function => { + let str = read_function(in_file); + if (typeof str !== 'string') + throw Error('Expected a string'); + check(str); + }; + + // jsc's original file reading function is `readFile`, whereas SpiderMonkey + // shell's file reading function is `read`. The latter is used by + // emscripten's shell.js (d8 calls it `readbuffer`, which shell.js + // polyfills). + test_arraybuffer(readFile); + test_arraybuffer(read); + test_string(readFile); + test_string(read); +})(); diff --git a/implementation-contributed/javascriptcore/stress/regress-169445.js b/implementation-contributed/javascriptcore/stress/regress-169445.js new file mode 100644 index 0000000000000000000000000000000000000000..a56a41ad74310c968c8c1e9678afd5be3d4705cd --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/regress-169445.js @@ -0,0 +1,46 @@ +//@ defaultNoNoLLIntRun if $architecture == "arm" + +let args = new Array(0x10000); +args.fill(); +args = args.map((_, i) => 'a' + i).join(', '); + +let gun = eval(`(function () { + class A { + + } + + class B extends A { + constructor(${args}) { + () => { + ${args}; + super(); + }; + + class C { + constructor() { + } + + trigger() { + (() => { + super.x; + })(); + } + + triggerWithRestParameters(...args) { + (() => { + super.x; + })(); + } + } + + return new C(); + } + } + + return new B(); +})()`); + +for (let i = 0; i < 0x10000; i++) { + gun.trigger(); + gun.triggerWithRestParameters(1, 2, 3); +} diff --git a/implementation-contributed/javascriptcore/stress/regress-189132.js b/implementation-contributed/javascriptcore/stress/regress-189132.js new file mode 100644 index 0000000000000000000000000000000000000000..cd0e57985a87990d66706bfaa90ea54f140d5c99 --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/regress-189132.js @@ -0,0 +1,14 @@ +//@ skip if $memoryLimited + +try { + var a0 = '\ud801'; + var a1 = []; + a2 = a0.padEnd(2147483644,'x'); + a1[a2]; +} catch (e) { + exception = e; +} + +if (exception != "Error: Out of memory") + throw "FAILED"; + diff --git a/implementation-contributed/javascriptcore/stress/regress-190186.js b/implementation-contributed/javascriptcore/stress/regress-190186.js new file mode 100644 index 0000000000000000000000000000000000000000..2f30c9d905c2b075040d1fe49f76270083d2916c --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/regress-190186.js @@ -0,0 +1,95 @@ +//@ runDefault("--useConcurrentJIT=false", "--sweepSynchronously=true") + +// This test passes if it does not crash with an ASAN build. + +(function() { + var bar = {}; + + for (var i = 0; i < 68; ++i) + String.raw`boo`; + + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + eval(String.raw`bar += 0;`); + + eval(String.raw`foo = class { };`); + foo += 0; + + gc(); + try { + eval(foo.toString()); + } catch (e) { + exception = e; + } + + if (exception != "SyntaxError: Class statements must have a name.") + throw "FAIL"; +})(); diff --git a/implementation-contributed/javascriptcore/stress/regress-190187.js b/implementation-contributed/javascriptcore/stress/regress-190187.js new file mode 100644 index 0000000000000000000000000000000000000000..63dc08e65cb5f01a9289c01e8e1b571965e0147e --- /dev/null +++ b/implementation-contributed/javascriptcore/stress/regress-190187.js @@ -0,0 +1,18 @@ +//@ skip if $memoryLimited or $buildType == "debug" +//@ runDefault +//@ slow! + +try { + var v1 = "AAAAAAAAAAA"; + for(var i = 0; i < 27; i++) + v1 = v1 + v1; + var v2; + var v3 = RegExp.prototype.toString.call({source:v1,flags:v1}); + v3 += v1; + v2 += v3.localeCompare(v1); +} catch (e) { + exception = e; +} + +if (exception != "Error: Out of memory") + throw "FAILED"; diff --git a/implementation-contributed/v8/intl/general/getCanonicalLocales.js b/implementation-contributed/v8/intl/general/getCanonicalLocales.js index 9bec67f581faafaa325a8f3c6b4ccb510e1cbb90..65c7fc6e3a8e2dbde02ed1bf64f620c384709449 100644 --- a/implementation-contributed/v8/intl/general/getCanonicalLocales.js +++ b/implementation-contributed/v8/intl/general/getCanonicalLocales.js @@ -7,9 +7,10 @@ assertDoesNotThrow(() => Intl.getCanonicalLocales("foobar-foobar")); // Ignore duplicate subtags in different namespaces; eg, 'a' vs 'u'. assertDoesNotThrow(() => Intl.getCanonicalLocales("en-a-ca-Chinese-u-ca-Chinese")); +// Ignore duplicate subtags in U-extension as well. Only the first count. +// See RFC 6067 for details. +assertDoesNotThrow(() => Intl.getCanonicalLocales("en-u-ca-gregory-ca-chinese")); +assertEquals("en-u-ca-gregory", Intl.getCanonicalLocales("en-u-ca-gregory-ca-chinese")[0]); // Check duplicate subtags (after the first tag) are detected. assertThrows(() => Intl.getCanonicalLocales("en-foobar-foobar"), RangeError); - -// Duplicate subtags are valid as per the ECMA262 spec. -assertDoesNotThrow(() => Intl.getCanonicalLocales("en-u-ca-gregory-ca-chinese")); diff --git a/implementation-contributed/v8/intl/general/grandfathered_tags_without_preferred_value.js b/implementation-contributed/v8/intl/general/grandfathered_tags_without_preferred_value.js index b4d529652f684a2de1cf6c21f8ffd8d98e9b6401..808e50d20884330f4e640b74d364fffa82b07647 100644 --- a/implementation-contributed/v8/intl/general/grandfathered_tags_without_preferred_value.js +++ b/implementation-contributed/v8/intl/general/grandfathered_tags_without_preferred_value.js @@ -23,5 +23,5 @@ ].forEach(([inputLocale, expectedLocale]) => { const canonicalLocales = Intl.getCanonicalLocales(inputLocale); assertEquals(canonicalLocales.length, 1); - assertEquals(canonicalLocales[0], expectedLocale); + assertEquals(expectedLocale, canonicalLocales[0]); }) diff --git a/implementation-contributed/v8/intl/general/language_tags_with_preferred_values.js b/implementation-contributed/v8/intl/general/language_tags_with_preferred_values.js index 073a6c9affd6347d6d0c70c8fa17f0f32a194105..4f2fbbfb2edd11958e06dc4740b0ae7dd4f42210 100644 --- a/implementation-contributed/v8/intl/general/language_tags_with_preferred_values.js +++ b/implementation-contributed/v8/intl/general/language_tags_with_preferred_values.js @@ -29,6 +29,6 @@ ["aam-u-ca-gregory", "aas-u-ca-gregory"], ].forEach(([inputLocale, expectedLocale]) => { const canonicalLocales = Intl.getCanonicalLocales(inputLocale); - assertEquals(canonicalLocales.length, 1); - assertEquals(canonicalLocales[0], expectedLocale); + assertEquals(1, canonicalLocales.length); + assertEquals(expectedLocale, canonicalLocales[0]); }) diff --git a/implementation-contributed/v8/intl/segmenter/constructor.js b/implementation-contributed/v8/intl/segmenter/constructor.js new file mode 100644 index 0000000000000000000000000000000000000000..db36c19d28966717ecc7cf2092c4321731c56ec2 --- /dev/null +++ b/implementation-contributed/v8/intl/segmenter/constructor.js @@ -0,0 +1,216 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-lineBreakStyle license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-segmenter + +// Segmenter constructor can't be called as function. +assertThrows(() => Intl.Segmenter(["sr"]), TypeError); + +// Invalid locale string. +assertThrows(() => new Intl.Segmenter(["abcdefghi"]), RangeError); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"], {}), TypeError); + +assertDoesNotThrow(() => new Intl.Segmenter([], {})); + +assertDoesNotThrow(() => new Intl.Segmenter(["fr", "ar"], {})); + +assertDoesNotThrow(() => new Intl.Segmenter({ 0: "ja", 1: "fr" }, {})); + +assertDoesNotThrow(() => new Intl.Segmenter({ 1: "ja", 2: "fr" }, {})); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"])); + +assertDoesNotThrow(() => new Intl.Segmenter()); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "grapheme" + }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { granularity: "sentence" }) +); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"], { granularity: "word" })); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { granularity: "grapheme" }) +); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"], { granularity: "line" })); + +assertThrows( + () => new Intl.Segmenter(["sr"], { granularity: "standard" }), + RangeError +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "normal" }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "strict" }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "loose" }) +); + +assertThrows( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "giant" }), + RangeError +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "sentence", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "sentence", + lineBreakStyle: "strict" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "sentence", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "word", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "word", + lineBreakStyle: "strict" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "word", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "grapheme", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "grapheme", + lineBreakStyle: "strict" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "grapheme", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "line", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "line", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "line", + lineBreakStyle: "strict" + }) +); + +// propagate exception from getter +assertThrows( + () => + new Intl.Segmenter(undefined, { + get localeMatcher() { + throw new TypeError(""); + } + }), + TypeError +); +assertThrows( + () => + new Intl.Segmenter(undefined, { + get lineBreakStyle() { + throw new TypeError(""); + } + }), + TypeError +); +assertThrows( + () => + new Intl.Segmenter(undefined, { + get granularity() { + throw new TypeError(""); + } + }), + TypeError +); + +// Throws only once during construction. +// Check for all getters to prevent regression. +// Preserve the order of getter initialization. +let getCount = 0; +let localeMatcher = -1; +let lineBreakStyle = -1; +let granularity = -1; + +new Intl.Segmenter(["en-US"], { + get localeMatcher() { + localeMatcher = ++getCount; + }, + get lineBreakStyle() { + lineBreakStyle = ++getCount; + }, + get granularity() { + granularity = ++getCount; + } +}); + +assertEquals(1, localeMatcher); +assertEquals(2, lineBreakStyle); +assertEquals(3, granularity); diff --git a/implementation-contributed/v8/intl/segmenter/resolved-options.js b/implementation-contributed/v8/intl/segmenter/resolved-options.js new file mode 100644 index 0000000000000000000000000000000000000000..7f9b7abb23eb8131dffa7ee61cc0f663d4f1c28e --- /dev/null +++ b/implementation-contributed/v8/intl/segmenter/resolved-options.js @@ -0,0 +1,299 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-lineBreakStyle license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-segmenter + +let segmenter = new Intl.Segmenter([], { granularity: "line" }); +// The default lineBreakStyle is 'normal' +assertEquals("normal", segmenter.resolvedOptions().lineBreakStyle); + +segmenter = new Intl.Segmenter(); +assertEquals(undefined, segmenter.resolvedOptions().lineBreakStyle); + +// The default granularity is 'grapheme' +assertEquals("grapheme", segmenter.resolvedOptions().granularity); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { lineBreakStyle: "strict" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { lineBreakStyle: "strict" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { lineBreakStyle: "normal" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { lineBreakStyle: "normal" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { lineBreakStyle: "loose" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { lineBreakStyle: "loose" }).resolvedOptions() + .granularity +); + +assertEquals( + "word", + new Intl.Segmenter(["sr"], { granularity: "word" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { granularity: "word" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { granularity: "grapheme" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { granularity: "grapheme" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "sentence", + new Intl.Segmenter(["sr"], { granularity: "sentence" }).resolvedOptions() + .granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { granularity: "sentence" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "line", + new Intl.Segmenter(["sr"], { granularity: "line" }).resolvedOptions() + .granularity +); + +assertEquals( + "normal", + new Intl.Segmenter(["sr"], { granularity: "line" }).resolvedOptions() + .lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "grapheme" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "grapheme" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "grapheme" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "grapheme" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "grapheme", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "grapheme" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "grapheme" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "word", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "word" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "word" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "word", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "word" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "word" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "word", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "word" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "word" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "sentence", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "sentence" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "sentence" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "sentence", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "sentence" + }).resolvedOptions().granularity +); + +assertEquals( + undefined, + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "sentence" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "sentence", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "sentence" + }).resolvedOptions().granularity +); + +assertEquals( + "normal", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "line" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "line", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "line" + }).resolvedOptions().granularity +); + +assertEquals( + "loose", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "loose", + granularity: "line" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "line", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "line" + }).resolvedOptions().granularity +); + +assertEquals( + "strict", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "line" + }).resolvedOptions().lineBreakStyle +); + +assertEquals( + "line", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "line" + }).resolvedOptions().granularity +); + +assertEquals( + "normal", + new Intl.Segmenter(["sr"], { + lineBreakStyle: "normal", + granularity: "line" + }).resolvedOptions().lineBreakStyle +); + +assertEquals("ar", new Intl.Segmenter(["ar"]).resolvedOptions().locale); + +assertEquals("ar", new Intl.Segmenter(["ar", "en"]).resolvedOptions().locale); + +assertEquals("fr", new Intl.Segmenter(["fr", "en"]).resolvedOptions().locale); + +assertEquals("ar", new Intl.Segmenter(["xyz", "ar"]).resolvedOptions().locale); diff --git a/implementation-contributed/v8/intl/segmenter/supported-locale.js b/implementation-contributed/v8/intl/segmenter/supported-locale.js new file mode 100644 index 0000000000000000000000000000000000000000..24825a27590939b8eee4a24729255407c510338d --- /dev/null +++ b/implementation-contributed/v8/intl/segmenter/supported-locale.js @@ -0,0 +1,22 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-segmenter +assertEquals( + typeof Intl.Segmenter.supportedLocalesOf, + "function", + "Intl.Segmenter.supportedLocalesOf should be a function" +); + +var undef = Intl.Segmenter.supportedLocalesOf(); +assertEquals([], undef); + +var empty = Intl.Segmenter.supportedLocalesOf([]); +assertEquals([], empty); + +var strLocale = Intl.Segmenter.supportedLocalesOf("sr"); +assertEquals("sr", strLocale[0]); + +var multiLocale = ["sr-Thai-RS", "de", "zh-CN"]; +assertEquals(multiLocale, Intl.Segmenter.supportedLocalesOf(multiLocale)); diff --git a/implementation-contributed/v8/mjsunit/async-stack-traces-prepare-stacktrace-1.js b/implementation-contributed/v8/mjsunit/async-stack-traces-prepare-stacktrace-1.js new file mode 100644 index 0000000000000000000000000000000000000000..42482595ccb6ceb6844009709e73b2cacd7895c1 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/async-stack-traces-prepare-stacktrace-1.js @@ -0,0 +1,31 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --async-stack-traces + +// Check that Error.prepareStackTrace doesn't expose strict +// mode closures, even in the presence of async frames. +Error.prepareStackTrace = (e, frames) => { + assertEquals(two, frames[0].getFunction()); + assertEquals(two.name, frames[0].getFunctionName()); + assertEquals(undefined, frames[1].getFunction()); + assertEquals(one.name, frames[1].getFunctionName()); + return frames; +}; + +async function one(x) { + "use strict"; + return await two(x); +} + +async function two(x) { + try { + x = await x; + throw new Error(); + } catch (e) { + return e.stack; + } +} + +one(1).catch(e => setTimeout(_ => {throw e}, 0)); diff --git a/implementation-contributed/v8/mjsunit/async-stack-traces-prepare-stacktrace-2.js b/implementation-contributed/v8/mjsunit/async-stack-traces-prepare-stacktrace-2.js new file mode 100644 index 0000000000000000000000000000000000000000..8126a83dc91612c8b2547527910619d617327202 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/async-stack-traces-prepare-stacktrace-2.js @@ -0,0 +1,31 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --async-stack-traces + +// Check that Error.prepareStackTrace doesn't expose strict +// mode closures, even in the presence of async frames. +Error.prepareStackTrace = (e, frames) => { + assertEquals(undefined, frames[0].getFunction()); + assertEquals(two.name, frames[0].getFunctionName()); + assertEquals(undefined, frames[1].getFunction()); + assertEquals(one.name, frames[1].getFunctionName()); + return frames; +}; + +async function one(x) { + return await two(x); +} + +async function two(x) { + "use strict"; + try { + x = await x; + throw new Error(); + } catch (e) { + return e.stack; + } +} + +one(1).catch(e => setTimeout(_ => {throw e}, 0)); diff --git a/implementation-contributed/v8/mjsunit/async-stack-traces-prepare-stacktrace-3.js b/implementation-contributed/v8/mjsunit/async-stack-traces-prepare-stacktrace-3.js new file mode 100644 index 0000000000000000000000000000000000000000..429b0f64c36ff90115bd696f833e215ca77dcb60 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/async-stack-traces-prepare-stacktrace-3.js @@ -0,0 +1,31 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --async-stack-traces + +// Check that Error.prepareStackTrace properly marks async frames. +Error.prepareStackTrace = (e, frames) => { + assertEquals(two, frames[0].getFunction()); + assertEquals(two.name, frames[0].getFunctionName()); + assertFalse(frames[0].isAsync()); + assertEquals(two, frames[1].getFunction()); + assertEquals(one.name, frames[1].getFunctionName()); + assertTrue(frames[1].isAsync()); + return frames; +}; + +async function one(x) { + return await two(x); +} + +async function two(x) { + try { + x = await x; + throw new Error(); + } catch (e) { + return e.stack; + } +} + +one(1).catch(e => setTimeout(_ => {throw e}, 0)); diff --git a/implementation-contributed/v8/mjsunit/async-stack-traces.js b/implementation-contributed/v8/mjsunit/async-stack-traces.js new file mode 100644 index 0000000000000000000000000000000000000000..05cf8a095f53e31717e32ba7f3285415b44bec42 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/async-stack-traces.js @@ -0,0 +1,270 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --async-stack-traces + +// Basic test with an explicit throw. +(function() { + async function one(x) { + await two(x); + } + + async function two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + await f(1); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async () => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test with an implicit throw (via ToNumber on Symbol). +(function() { + async function one(x) { + return await two(x); + } + + async function two(x) { + await x; + return +x; // This will raise a TypeError. + } + + async function test(f) { + try { + await f(Symbol()); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, TypeError); + assertMatches(/TypeError.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async() => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test with throw in inlined function. +(function() { + function throwError() { + throw new Error(); + } + + async function one(x) { + return await two(x); + } + + async function two(x) { + await x; + return throwError(); + } + + async function test(f) { + try { + await f(1); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async() => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test with async function inlined into sync function. +(function() { + function callOne(x) { + return one(x); + } + + function callTwo(x) { + return two(x); + } + + async function one(x) { + return await callTwo(x); + } + + async function two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + await f(1); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async() => { + await test(callOne); + await test(callOne); + %OptimizeFunctionOnNextCall(callTwo); + await test(callOne); + %OptimizeFunctionOnNextCall(callOne); + await test(callOne); + })()); +})(); + +// Basic test with async functions and promises chained via +// Promise.prototype.then(), which should still work following +// the generic chain upwards. +(function() { + async function one(x) { + return await two(x).then(x => x); + } + + async function two(x) { + await x.then(x => x); + throw new Error(); + } + + async function test(f) { + try { + await f(Promise.resolve(1)); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async() => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test for async generators called from async +// functions with an explicit throw. +(function() { + async function one(x) { + for await (const y of two(x)) {} + } + + async function* two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + await f(1); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async () => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test for async functions called from async +// generators with an explicit throw. +(function() { + async function* one(x) { + await two(x); + } + + async function two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + for await (const x of f(1)) {} + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async () => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); + +// Basic test for async functions called from async +// generators with an explicit throw (with yield). +(function() { + async function* one(x) { + yield two(x); + } + + async function two(x) { + await x; + throw new Error(); + } + + async function test(f) { + try { + for await (const x of f(1)) {} + assertUnreachable(); + } catch (e) { + assertInstanceof(e, Error); + assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack); + } + } + + assertPromiseResult((async () => { + await test(one); + await test(one); + %OptimizeFunctionOnNextCall(two); + await test(one); + %OptimizeFunctionOnNextCall(one); + await test(one); + })()); +})(); diff --git a/implementation-contributed/v8/mjsunit/code-coverage-block.js b/implementation-contributed/v8/mjsunit/code-coverage-block.js index 2ecd1b0d1e15dd93119fbbeb9c97dff80681c5c4..61ed87fc13e15442fd2a7175fcf6a42f81280a48 100644 --- a/implementation-contributed/v8/mjsunit/code-coverage-block.js +++ b/implementation-contributed/v8/mjsunit/code-coverage-block.js @@ -471,7 +471,7 @@ TestCoverage( {"start":472,"end":503,"count":0}, {"start":626,"end":653,"count":0}, {"start":768,"end":803,"count":0}, - {"start":867,"end":869,"count":0}] + {"start":867,"end":868,"count":0}] ); TestCoverage( @@ -847,7 +847,7 @@ Util.escape("foo.bar"); // 0400 [{"start":0,"end":449,"count":1}, {"start":64,"end":351,"count":1}, {"start":112,"end":203,"count":0}, - {"start":303,"end":350,"count":0}] + {"start":268,"end":350,"count":0}] ); %DebugToggleBlockCoverage(false); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-abs.js b/implementation-contributed/v8/mjsunit/compiler/number-abs.js new file mode 100644 index 0000000000000000000000000000000000000000..9eb8ab5bb50d56ddbbbdc7e8e6ea3b2e2cbb2275 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/number-abs.js @@ -0,0 +1,76 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt + +// Test that NumberAbs correctly deals with PositiveInteger \/ MinusZero +// and turns the -0 into a 0. +(function() { + function foo(x) { + x = Math.floor(x); + x = Math.max(x, -0); + return 1 / Math.abs(x); + } + + assertEquals(Infinity, foo(-0)); + assertEquals(Infinity, foo(-0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(Infinity, foo(-0)); +})(); + +// Test that NumberAbs properly passes the kIdentifyZeros truncation +// for Signed32 \/ MinusZero inputs. +(function() { + function foo(x) { + return Math.abs(x * -2); + } + + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); + +// Test that NumberAbs properly passes the kIdentifyZeros truncation +// for Unsigned32 \/ MinusZero inputs. +(function() { + function foo(x) { + x = x | 0; + return Math.abs(Math.max(x * -2, 0)); + } + + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); + +// Test that NumberAbs properly passes the kIdentifyZeros truncation +// for OrderedNumber inputs. +(function() { + function foo(x) { + x = x | 0; + return Math.abs(Math.min(x * -2, 2 ** 32)); + } + + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(-1)); + assertEquals(4, foo(-2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-ceil.js b/implementation-contributed/v8/mjsunit/compiler/number-ceil.js new file mode 100644 index 0000000000000000000000000000000000000000..ce87cd0fc0596bbd7ffcea2edb3d0dc01fe089f2 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/number-ceil.js @@ -0,0 +1,22 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt + +// Test that NumberCeil propagates kIdentifyZeros truncations. +(function() { + function foo(x) { + return Math.abs(Math.ceil(x * -2)); + } + + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-comparison-truncations.js b/implementation-contributed/v8/mjsunit/compiler/number-comparison-truncations.js new file mode 100644 index 0000000000000000000000000000000000000000..33abf6b913c02be7e01114b013c7f3bf059296a5 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/number-comparison-truncations.js @@ -0,0 +1,152 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt + +// Test that SpeculativeNumberEqual[SignedSmall] properly passes the +// kIdentifyZeros truncation. +(function() { + function foo(x, y) { + if (x * y === 0) return 0; + return 1; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(0, foo(-3, 0)); + assertEquals(0, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberEqual[Number] properly passes the +// kIdentifyZeros truncation. +(function() { + // Produce a SpeculativeNumberEqual with Number feedback. + function bar(x, y) { return x === y; } + bar(0.1, 0.5); + bar(-0, 100); + + function foo(x, y) { + if (bar(x * y, 0)) return 0; + return 1; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(0, foo(-3, 0)); + assertEquals(0, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberLessThan[SignedSmall] properly passes the +// kIdentifyZeros truncation. +(function() { + function foo(x, y) { + if (x * y < 0) return 0; + return 1; + } + + assertEquals(0, foo(1, -1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1, -1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(1, foo(-3, 0)); + assertEquals(1, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberLessThan[Number] properly passes the +// kIdentifyZeros truncation. +(function() { + // Produce a SpeculativeNumberLessThan with Number feedback. + function bar(x, y) { return x < y; } + bar(0.1, 0.5); + bar(-0, 100); + + function foo(x, y) { + if (bar(x * y, 0)) return 0; + return 1; + } + + assertEquals(0, foo(1, -1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1, -1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(1, foo(-3, 0)); + assertEquals(1, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberLessThanOrEqual[SignedSmall] properly passes the +// kIdentifyZeros truncation. +(function() { + function foo(x, y) { + if (x * y <= 0) return 0; + return 1; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(0, foo(-3, 0)); + assertEquals(0, foo(0, -3)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberLessThanOrEqual[Number] properly passes the +// kIdentifyZeros truncation. +(function() { + // Produce a SpeculativeNumberLessThanOrEqual with Number feedback. + function bar(x, y) { return x <= y; } + bar(0.1, 0.5); + bar(-0, 100); + + function foo(x, y) { + if (bar(x * y, 0)) return 0; + return 1; + } + + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(0, 1)); + assertEquals(1, foo(1, 1)); + assertEquals(1, foo(1, 2)); + assertOptimized(foo); + // Even if x*y produces -0 now, it should stay optimized. + assertEquals(0, foo(-3, 0)); + assertEquals(0, foo(0, -3)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-floor.js b/implementation-contributed/v8/mjsunit/compiler/number-floor.js new file mode 100644 index 0000000000000000000000000000000000000000..180b89e5590cb5fae2df7c428dc229713c798299 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/number-floor.js @@ -0,0 +1,22 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt + +// Test that NumberFloor propagates kIdentifyZeros truncations. +(function() { + function foo(x) { + return Math.abs(Math.floor(x * -2)); + } + + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-max.js b/implementation-contributed/v8/mjsunit/compiler/number-max.js new file mode 100644 index 0000000000000000000000000000000000000000..7e5a4a4ad11b62efbe5656997da1ffb49fe33d6d --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/number-max.js @@ -0,0 +1,23 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt + +// Test that NumberMax properly passes the kIdentifyZeros truncation. +(function() { + function foo(x) { + if (Math.max(x * -2, 1) == 1) return 0; + return 1; + } + + assertEquals(0, foo(2)); + assertEquals(1, foo(-1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(2)); + assertEquals(1, foo(-1)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-min.js b/implementation-contributed/v8/mjsunit/compiler/number-min.js new file mode 100644 index 0000000000000000000000000000000000000000..72bff78686f10589bf40e052d9c5b3e62f8348d4 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/number-min.js @@ -0,0 +1,23 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt + +// Test that NumberMin properly passes the kIdentifyZeros truncation. +(function() { + function foo(x) { + if (Math.min(x * -2, -1) == -2) return 0; + return 1; + } + + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + assertEquals(1, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(1, foo(0)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-modulus.js b/implementation-contributed/v8/mjsunit/compiler/number-modulus.js index cccb93b8033436fb000f974359bd875c9dadff2f..5f695d1ee572d00f46a6a3dce993d65724b7d6d5 100644 --- a/implementation-contributed/v8/mjsunit/compiler/number-modulus.js +++ b/implementation-contributed/v8/mjsunit/compiler/number-modulus.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --opt +// Flags: --allow-natives-syntax --opt --noalways-opt // Test that NumberModulus with Number feedback works if only in the // end SimplifiedLowering figures out that the inputs to this operation @@ -123,3 +123,134 @@ assertEquals(1, foo(4)); assertOptimized(foo); })(); + +// Test that NumberModulus works in the case where TurboFan +// can infer that the output is Signed32 \/ MinusZero, and +// there's a truncation on the result that identifies zeros +// (via the SpeculativeNumberEqual). +(function() { + // We need a separately polluted % with NumberOrOddball feedback. + function bar(x) { return x % 2; } + bar(undefined); // The % feedback is now NumberOrOddball. + + // Now we just use the gadget above on an `x` that is known + // to be in Signed32 range and compare it to 0, which passes + // a truncation that identifies zeros. + function foo(x) { + if (bar(x | 0) == 0) return 0; + return 1; + } + + assertEquals(0, foo(2)); + assertEquals(1, foo(1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(2)); + assertEquals(1, foo(1)); + assertOptimized(foo); + + // Now `foo` should stay optimized even if `x % 2` would + // produce -0, aka when we pass a negative value for `x`. + assertEquals(0, foo(-2)); + assertEquals(1, foo(-1)); + assertOptimized(foo); +})(); + +// Test that CheckedInt32Mod handles the slow-path (when +// the left hand side is negative) correctly. +(function() { + // We need a SpeculativeNumberModulus with SignedSmall feedback. + function foo(x, y) { + return x % y; + } + + assertEquals(0, foo(2, 1)); + assertEquals(0, foo(2, 2)); + assertEquals(-1, foo(-3, 2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(2, 1)); + assertEquals(0, foo(2, 2)); + assertEquals(-1, foo(-3, 2)); + assertOptimized(foo); + + // Now `foo` should deoptimize if the result is -0. + assertEquals(-0, foo(-2, 2)); + assertUnoptimized(foo); +})(); + +// Test that NumberModulus passes kIdentifiesZero to the +// left hand side input when the result doesn't care about +// 0 vs -0, even when the inputs are outside Signed32. +(function() { + function foo(x) { + return (x * -2) % (2 ** 32) === 0; + } + + assertFalse(foo(2)); + assertFalse(foo(1)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(2)); + assertFalse(foo(1)); + + // Now `foo` should stay optimized even if `x * -2` would + // produce -0, aka when we pass a zero value for `x`. + assertTrue(foo(0)); + assertOptimized(foo); +})(); + +// Test that NumberModulus passes kIdentifiesZero to the +// right hand side input, even when the inputs are outside +// the Signed32 range. +(function() { + function foo(x) { + return (2 ** 32) % (x * -2); + } + + assertEquals(0, foo(1)); + assertEquals(0, foo(1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(1)); + + // Now `foo` should stay optimized even if `x * -2` would + // produce -0, aka when we pass a zero value for `x`. + assertEquals(NaN, foo(0)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberModulus passes kIdentifiesZero +// to the right hand side input, even when feedback is consumed. +(function() { + function foo(x, y) { + return (x % (y * -2)) | 0; + } + + assertEquals(0, foo(2, 1)); + assertEquals(-1, foo(-3, 1)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(0, foo(2, 1)); + assertEquals(-1, foo(-3, 1)); + assertOptimized(foo); + + // Now `foo` should stay optimized even if `y * -2` would + // produce -0, aka when we pass a zero value for `y`. + assertEquals(0, foo(2, 0)); + assertOptimized(foo); +})(); + +// Test that SpeculativeNumberModulus passes kIdentifiesZero +// to the left hand side input, even when feedback is consumed. +(function() { + function foo(x, y) { + return ((x * -2) % y) | 0; + } + + assertEquals(-2, foo(1, 3)); + assertEquals(-2, foo(1, 3)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(-2, foo(1, 3)); + assertOptimized(foo); + + // Now `foo` should stay optimized even if `x * -2` would + // produce -0, aka when we pass a zero value for `x`. + assertEquals(0, foo(0, 2)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-round.js b/implementation-contributed/v8/mjsunit/compiler/number-round.js new file mode 100644 index 0000000000000000000000000000000000000000..9aec7f7a1268c6fccb4ab4e8f31cef357597f83e --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/number-round.js @@ -0,0 +1,22 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt + +// Test that NumberRound propagates kIdentifyZeros truncations. +(function() { + function foo(x) { + return Math.abs(Math.round(x * -2)); + } + + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-toboolean.js b/implementation-contributed/v8/mjsunit/compiler/number-toboolean.js new file mode 100644 index 0000000000000000000000000000000000000000..02b30b3ed672dbe94ba1e7d277169d97b1a1ba46 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/number-toboolean.js @@ -0,0 +1,45 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt + +// Test that NumberToBoolean properly passes the kIdentifyZeros truncation +// for Signed32 \/ MinusZero inputs. +(function() { + function foo(x) { + if (x * -2) return 1; + return 0; + } + + assertEquals(1, foo(1)); + assertEquals(1, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(1)); + assertEquals(1, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); + + +// Test that NumberToBoolean properly passes the kIdentifyZeros truncation +// for Unsigned32 \/ MinusZero inputs. +(function() { + function foo(x) { + x = x | 0; + if (Math.max(x * -2, 0)) return 1; + return 0; + } + + assertEquals(1, foo(-1)); + assertEquals(1, foo(-2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(1, foo(-1)); + assertEquals(1, foo(-2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/number-trunc.js b/implementation-contributed/v8/mjsunit/compiler/number-trunc.js new file mode 100644 index 0000000000000000000000000000000000000000..aa7d02c20fca6ff0b6725f1ebb0c53069ed875c4 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/number-trunc.js @@ -0,0 +1,22 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt + +// Test that NumberTrunc propagates kIdentifyZeros truncations. +(function() { + function foo(x) { + return Math.abs(Math.trunc(x * -2)); + } + + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + %OptimizeFunctionOnNextCall(foo); + assertEquals(2, foo(1)); + assertEquals(4, foo(2)); + assertOptimized(foo); + // Now `foo` should stay optimized even if `x * -2` would produce `-0`. + assertEquals(0, foo(0)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/regress-7121.js b/implementation-contributed/v8/mjsunit/compiler/regress-7121.js index 98c1a1ac19f9fb8e0713bceec21c60b1d90da443..bdf3133bb8d89e5cfaef41782556439500180466 100644 --- a/implementation-contributed/v8/mjsunit/compiler/regress-7121.js +++ b/implementation-contributed/v8/mjsunit/compiler/regress-7121.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --harmony-bigint +// Flags: --allow-natives-syntax function foo() { %_ToLength(42n) } assertThrows(foo, TypeError); diff --git a/implementation-contributed/v8/mjsunit/compiler/regress-890057.js b/implementation-contributed/v8/mjsunit/compiler/regress-890057.js new file mode 100644 index 0000000000000000000000000000000000000000..655c4431e9f5dd5ba884bed11661e2fd1747e208 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/regress-890057.js @@ -0,0 +1,16 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function f() {} +function g() { + f.prototype = undefined; + f(); + new f(); +} + +// Do not use %OptimizeFunctionOnNextCall here, this particular bug needs +// to trigger truly concurrent compilation. +for (let i = 0; i < 10000; i++) g(); diff --git a/implementation-contributed/v8/mjsunit/compiler/regress-890620.js b/implementation-contributed/v8/mjsunit/compiler/regress-890620.js new file mode 100644 index 0000000000000000000000000000000000000000..f5fc7f4f659a144ed99c97c48cb2363a51d776af --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/regress-890620.js @@ -0,0 +1,25 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var a = 42; + +function g(n) { + while (n > 0) { + a = new Array(n); + n--; + } +} + +g(1); + +function f() { + g(); +} + +f(); +%OptimizeFunctionOnNextCall(f); +f(); +assertEquals(1, a.length); diff --git a/implementation-contributed/v8/mjsunit/compiler/stress-deopt-count-2.js b/implementation-contributed/v8/mjsunit/compiler/stress-deopt-count-2.js index 641a9e8180a5ea6bbacc579b4115e07ca82617af..918b4e00ade1b0adb2b718880abd508c5478b464 100644 --- a/implementation-contributed/v8/mjsunit/compiler/stress-deopt-count-2.js +++ b/implementation-contributed/v8/mjsunit/compiler/stress-deopt-count-2.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --opt --no-always-opt --deopt-every-n-times=6 +// Flags: --allow-natives-syntax --opt --no-always-opt --deopt-every-n-times=3 // Check that stress deopt count resets correctly @@ -14,34 +14,34 @@ function f(x) { f(1); %OptimizeFunctionOnNextCall(f); -// stress_deopt_count == 6 +// stress_deopt_count == 3 f(1); assertOptimized(f, undefined, undefined, false); -// stress_deopt_count == 4 +// stress_deopt_count == 2 f(1); assertOptimized(f, undefined, undefined, false); -// stress_deopt_count == 2 +// stress_deopt_count == 1 f(1); // deopt & counter reset assertUnoptimized(f, undefined, undefined, false); -// stress_deopt_count == 6 +// stress_deopt_count == 3 %OptimizeFunctionOnNextCall(f); f(1); assertOptimized(f, undefined, undefined, false); -// stress_deopt_count == 4 +// stress_deopt_count == 2 f(1); assertOptimized(f, undefined, undefined, false); -// stress_deopt_count == 2 +// stress_deopt_count == 1 f(1); // deopt & counter reset diff --git a/implementation-contributed/v8/mjsunit/compiler/string-from-code-point.js b/implementation-contributed/v8/mjsunit/compiler/string-from-code-point.js new file mode 100644 index 0000000000000000000000000000000000000000..165ea0c2343c01cb88b032d8d2b3c917f7de05b1 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/string-from-code-point.js @@ -0,0 +1,32 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --opt --noalways-opt + +// Test that String.fromCodePoint() properly identifies zeros. +(function() { + function foo(x) { + return String.fromCodePoint(x); + } + + assertEquals("\u0000", foo(0)); + assertEquals("\u0000", foo(-0)); + %OptimizeFunctionOnNextCall(foo); + assertEquals("\u0000", foo(0)); + assertEquals("\u0000", foo(-0)); + assertOptimized(foo); + + // Now passing anything outside the valid code point + // range should invalidate the optimized code. + assertThrows(_ => foo(-1)); + assertUnoptimized(foo); + + // And TurboFan should not inline the builtin anymore + // from now on (aka no deoptimization loop). + %OptimizeFunctionOnNextCall(foo); + assertEquals("\u0000", foo(0)); + assertEquals("\u0000", foo(-0)); + assertThrows(_ => foo(-1)); + assertOptimized(foo); +})(); diff --git a/implementation-contributed/v8/mjsunit/compiler/typed-array-constructor.js b/implementation-contributed/v8/mjsunit/compiler/typed-array-constructor.js index a785eadf37b62f698247c2ae71194eb5b28f0c14..07d6a7ca4e64682f598428ff089fa448d4f0b562 100644 --- a/implementation-contributed/v8/mjsunit/compiler/typed-array-constructor.js +++ b/implementation-contributed/v8/mjsunit/compiler/typed-array-constructor.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --harmony-bigint +// Flags: --allow-natives-syntax const limit = %MaxSmi() + 1; diff --git a/implementation-contributed/v8/mjsunit/es6/proxy-function-tostring.js b/implementation-contributed/v8/mjsunit/es6/proxy-function-tostring.js index d859822df01d0ff4c386f62948d328cad98935eb..e151bf65b1374a7bb572e1e10237f34d0a1dcc52 100644 --- a/implementation-contributed/v8/mjsunit/es6/proxy-function-tostring.js +++ b/implementation-contributed/v8/mjsunit/es6/proxy-function-tostring.js @@ -1,7 +1,6 @@ // Copyright 2018 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// -// Flags: --noharmony-function-tostring -assertThrows(() => new Proxy(function() {}, {}).toString(), TypeError); +assertEquals(new Proxy(function() {}, {}).toString(), + 'function () { [native code] }'); diff --git a/implementation-contributed/v8/mjsunit/es6/string-iterator2.js b/implementation-contributed/v8/mjsunit/es6/string-iterator2.js new file mode 100644 index 0000000000000000000000000000000000000000..2c23a4aa7643e5ae6acd7105469b4bdf073c98bb --- /dev/null +++ b/implementation-contributed/v8/mjsunit/es6/string-iterator2.js @@ -0,0 +1,24 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-stress-opt + +// Tests for primitive strings. + +var str = 'ott'; +assertEquals(['o', 't', 't'], [...str]); +assertTrue(%StringIteratorProtector()); + +str[Symbol.iterator] = {}; +// Symbol.iterator can't be set on primitive strings, so it shouldn't invalidate +// the protector. +assertTrue(%StringIteratorProtector()); + +// This changes the String Iterator prototype. No more tests should be run after +// this in the same instance. +var iterator = str[Symbol.iterator](); +iterator.__proto__.next = () => ({value : undefined, done : true}); + +assertFalse(%StringIteratorProtector()); +assertEquals([], [...str]); diff --git a/implementation-contributed/v8/mjsunit/es6/string-iterator3.js b/implementation-contributed/v8/mjsunit/es6/string-iterator3.js new file mode 100644 index 0000000000000000000000000000000000000000..1b0e0273e566997fadcc74707947de7b7a90b24d --- /dev/null +++ b/implementation-contributed/v8/mjsunit/es6/string-iterator3.js @@ -0,0 +1,20 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-stress-opt + +// Tests for primitive strings. + +var str = 'ott'; +assertTrue(%StringIteratorProtector()); +assertEquals(['o', 't', 't'], [...str]); + +// This changes the String prototype. No more tests should be run after this in +// the same instance. +str.__proto__[Symbol.iterator] = + function() { + return {next : () => ({value : undefined, done : true})}; + }; +assertFalse(%StringIteratorProtector()); +assertEquals([], [...str]); diff --git a/implementation-contributed/v8/mjsunit/es6/string-iterator4.js b/implementation-contributed/v8/mjsunit/es6/string-iterator4.js new file mode 100644 index 0000000000000000000000000000000000000000..48c6521d3b269b3fd2001c7ce229470924b5dccc --- /dev/null +++ b/implementation-contributed/v8/mjsunit/es6/string-iterator4.js @@ -0,0 +1,30 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-stress-opt + +// Tests for wrapped strings. + +var str = new String('ott'); +assertTrue(%StringIteratorProtector()); +assertEquals(['o', 't', 't'], [...str]); + +function iterator_fn() { + return {next : () => ({value : undefined, done : true})}; +}; + +str[Symbol.iterator] = iterator_fn; +// This shouldn't invalidate the protector, because it doesn't support String +// objects. +assertTrue(%StringIteratorProtector()); +assertEquals([], [...str]); + + +var str2 = new String('ott'); +assertEquals(['o', 't', 't'], [...str2]); +// This changes the String prototype. No more tests should be run after this in +// the same instance. +str2.__proto__[Symbol.iterator] = iterator_fn; +assertFalse(%StringIteratorProtector()); +assertEquals([], [...str2]); diff --git a/implementation-contributed/v8/mjsunit/es6/string-iterator5.js b/implementation-contributed/v8/mjsunit/es6/string-iterator5.js new file mode 100644 index 0000000000000000000000000000000000000000..ec9754a4bd5af37e868f7995889610f6eda57047 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/es6/string-iterator5.js @@ -0,0 +1,15 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +// Tests for primitive strings. + +var iterator = 'ott'[Symbol.iterator](); + +// These modifications shouldn't invalidate the String iterator protector. +iterator.__proto__.fonts = {}; +assertTrue(%StringIteratorProtector()); +iterator.__proto__[0] = 0; +assertTrue(%StringIteratorProtector()); diff --git a/implementation-contributed/v8/mjsunit/es6/string-iterator6.js b/implementation-contributed/v8/mjsunit/es6/string-iterator6.js new file mode 100644 index 0000000000000000000000000000000000000000..d1cd1f31ebae5fdc6a508d52e5c3bc80d6be6f05 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/es6/string-iterator6.js @@ -0,0 +1,11 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-stress-opt + +assertTrue(%StringIteratorProtector()); + +delete 'ott'.__proto__[Symbol.iterator]; + +assertFalse(%StringIteratorProtector()); diff --git a/implementation-contributed/v8/mjsunit/es6/string-iterator7.js b/implementation-contributed/v8/mjsunit/es6/string-iterator7.js new file mode 100644 index 0000000000000000000000000000000000000000..387c6e81fc57b5187fa2d623938a19bb3d783689 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/es6/string-iterator7.js @@ -0,0 +1,13 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +assertTrue(%StringIteratorProtector()); + +const p = ""[Symbol.iterator]().__proto__; +let x = Object.create(p); +x.next = 42; + +assertTrue(%StringIteratorProtector()); diff --git a/implementation-contributed/v8/mjsunit/es6/string-iterator8.js b/implementation-contributed/v8/mjsunit/es6/string-iterator8.js new file mode 100644 index 0000000000000000000000000000000000000000..dbd4b7c46a22746bcd50eaf7a4b7b11487be5a83 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/es6/string-iterator8.js @@ -0,0 +1,14 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +assertTrue(%StringIteratorProtector()); + +var proto = String.prototype; + +String.prototype = {}; + +assertEquals(proto, String.prototype); +assertTrue(%StringIteratorProtector()); diff --git a/implementation-contributed/v8/mjsunit/es6/typedarray-construct-by-array-like.js b/implementation-contributed/v8/mjsunit/es6/typedarray-construct-by-array-like.js index 3b57f8f644d1db2650be86e8c620832bf54dc495..0a55fccf5c8bd63035e5f424276a6a4d8e84611b 100644 --- a/implementation-contributed/v8/mjsunit/es6/typedarray-construct-by-array-like.js +++ b/implementation-contributed/v8/mjsunit/es6/typedarray-construct-by-array-like.js @@ -212,7 +212,7 @@ tests.push(function TestFromTypedArraySpeciesNeutersBuffer(constr) { }); tests.push(function TestLengthIsMaxSmi(constr) { - var myObject = { 0: 5, 1: 6, length: %_MaxSmi() + 1 }; + var myObject = { 0: 5, 1: 6, length: %MaxSmi() + 1 }; assertThrows(function() { new constr(myObject); @@ -258,7 +258,7 @@ tests.push(function TestOffsetIsUsed(constr) { }); tests.push(function TestLengthIsNonSmiNegativeNumber(constr) { - var ta = new constr({length: -%_MaxSmi() - 2}); + var ta = new constr({length: -%MaxSmi() - 2}); assertEquals(0, ta.length); }); diff --git a/implementation-contributed/v8/mjsunit/es6/typedarray-construct-offset-not-smi.js b/implementation-contributed/v8/mjsunit/es6/typedarray-construct-offset-not-smi.js index 0a267bc64b7d1ca42118e97f23ca8633a920588e..e6cbcc42013e9ab64019b3d811c2c93a82e77e31 100644 --- a/implementation-contributed/v8/mjsunit/es6/typedarray-construct-offset-not-smi.js +++ b/implementation-contributed/v8/mjsunit/es6/typedarray-construct-offset-not-smi.js @@ -5,7 +5,7 @@ // Flags: --allow-natives-syntax --mock-arraybuffer-allocator (function TestBufferByteLengthNonSmi() { - var non_smi_byte_length = %_MaxSmi() + 1; + var non_smi_byte_length = %MaxSmi() + 1; var buffer = new ArrayBuffer(non_smi_byte_length); @@ -20,7 +20,7 @@ })(); (function TestByteOffsetNonSmi() { - var non_smi_byte_length = %_MaxSmi() + 11; + var non_smi_byte_length = %MaxSmi() + 11; var buffer = new ArrayBuffer(non_smi_byte_length); diff --git a/implementation-contributed/v8/mjsunit/es6/typedarray-set-bytelength-not-smi.js b/implementation-contributed/v8/mjsunit/es6/typedarray-set-bytelength-not-smi.js index 1f842878dc5ea045938718a5fc0b978baeac2ef2..e4a8c2b626352a46cc12616348995a942f60ee65 100644 --- a/implementation-contributed/v8/mjsunit/es6/typedarray-set-bytelength-not-smi.js +++ b/implementation-contributed/v8/mjsunit/es6/typedarray-set-bytelength-not-smi.js @@ -5,13 +5,13 @@ // Flags: --allow-natives-syntax --mock-arraybuffer-allocator (function TestBufferByteLengthNonSmi() { - const source_buffer_length = %_MaxSmi() + 1; + const source_buffer_length = %MaxSmi() + 1; const source_buffer = new ArrayBuffer(source_buffer_length); const source = new Uint16Array(source_buffer); assertEquals(source_buffer_length, source_buffer.byteLength); assertEquals(source_buffer_length / 2, source.length); - const target_buffer_length = %_MaxSmi() - 1; + const target_buffer_length = %MaxSmi() - 1; const target_buffer = new ArrayBuffer(target_buffer_length); const target = new Uint16Array(target_buffer); assertEquals(target_buffer_length, target_buffer.byteLength); diff --git a/implementation-contributed/v8/mjsunit/harmony/async-await-optimization.js b/implementation-contributed/v8/mjsunit/harmony/async-await-optimization.js new file mode 100644 index 0000000000000000000000000000000000000000..b24e54191686bd6aa1b3150120f74015f30638d3 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/harmony/async-await-optimization.js @@ -0,0 +1,124 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-await-optimization + +// test basic interleaving +(function () { + const actual = []; + const expected = [ 'await', 1, 'await', 2 ]; + const iterations = 2; + + async function pushAwait() { + actual.push('await'); + } + + async function callAsync() { + for (let i = 0; i < iterations; i++) { + await pushAwait(); + } + return 0; + } + + function checkAssertions() { + assertArrayEquals(expected, actual, + 'Async/await and promises should be interleaved.'); + } + + assertPromiseResult((async() => { + callAsync(); + + return new Promise(function (resolve) { + actual.push(1); + resolve(); + }).then(function () { + actual.push(2); + }).then(checkAssertions); + })()); +})(); + +// test async generators +(function () { + const actual = []; + const expected = [ 'await', 1, 'await', 2 ]; + const iterations = 2; + + async function pushAwait() { + actual.push('await'); + } + + async function* callAsync() { + for (let i = 0; i < iterations; i++) { + await pushAwait(); + } + return 0; + } + + function checkAssertions() { + assertArrayEquals(expected, actual, + 'Async/await and promises should be interleaved when using async generators.'); + } + + assertPromiseResult((async() => { + callAsync().next(); + + return new Promise(function (resolve) { + actual.push(1); + resolve(); + }).then(function () { + actual.push(2); + }).then(checkAssertions); + })()); +})(); + +// test yielding from async generators +(function () { + const actual = []; + const expected = [ + 'Promise: 6', + 'Promise: 5', + 'Await: 3', + 'Promise: 4', + 'Promise: 3', + 'Await: 2', + 'Promise: 2', + 'Promise: 1', + 'Await: 1', + 'Promise: 0' + ]; + const iterations = 3; + + async function* naturalNumbers(start) { + let current = start; + while (current > 0) { + yield Promise.resolve(current--); + } + } + + async function trigger() { + for await (const num of naturalNumbers(iterations)) { + actual.push('Await: ' + num); + } + } + + async function checkAssertions() { + assertArrayEquals(expected, actual, + 'Async/await and promises should be interleaved when yielding.'); + } + + async function countdown(counter) { + actual.push('Promise: ' + counter); + if (counter > 0) { + return Promise.resolve(counter - 1).then(countdown); + } else { + await checkAssertions(); + } + } + + assertPromiseResult((async() => { + trigger(); + + return countdown(iterations * 2); + })()); +})(); diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/add.js b/implementation-contributed/v8/mjsunit/harmony/bigint/add.js index 5e986b3726277364816b576620e2c5068f7743ef..791db6a3b984a329ee625c6de06db10ba986bccb 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/add.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/add.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: -0xc4043e2c4cc49e4d6870103ce7c2ff2d512bf4b1b67553ba410db514ee0af8888ad6cfn, b: 0x2aae86de73ff479133a657a40d26e8dcf192019c7421836615ec34978bad93n, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/and.js b/implementation-contributed/v8/mjsunit/harmony/bigint/and.js index 7a68f8b3dc1e13a8e047fded2e2b7ea6c8b7b41b..a90ec22f5110a08ceecaa5d51042d5d132fa0811 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/and.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/and.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x9252b94f220ded0c18706998886397699c5a25527575dn, b: -0x286817ba2e8fd8n, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/as-int-n.js b/implementation-contributed/v8/mjsunit/harmony/bigint/as-int-n.js index 51b5073d2408c30d77be800b6a7efabed5b569be..154a0929e51d2eff8669eceb112184ddca47a89e 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/as-int-n.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/as-int-n.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-bigint - // BigInt.asIntN { assertEquals(2, BigInt.asIntN.length); diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/basics.js b/implementation-contributed/v8/mjsunit/harmony/bigint/basics.js index b6318d5324646ee3d8b805f8d0de7d98539faa26..0368c69b52109c5e126a3369aec5b0b7969687dc 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/basics.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/basics.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --harmony-bigint +// Flags: --allow-natives-syntax 'use strict' diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/comparisons.js b/implementation-contributed/v8/mjsunit/harmony/bigint/comparisons.js index 513131555ac25b26e24b07200cca3e70106a7fa6..abc7a8082ae809096b184fb91055e6abb8062a6c 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/comparisons.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/comparisons.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --harmony-bigint +// Flags: --allow-natives-syntax 'use strict' diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/dataview.js b/implementation-contributed/v8/mjsunit/harmony/bigint/dataview.js index 5ead64990971f195f83b2a24b7173d70a75600fa..bad56d2b699c7b4ed7ef857848726591c44ebc6a 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/dataview.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/dataview.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-bigint - var buffer = new ArrayBuffer(64); var dataview = new DataView(buffer, 8, 24); var bytes = new Uint8Array(buffer); diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/dec.js b/implementation-contributed/v8/mjsunit/harmony/bigint/dec.js index ddb0431cba74978ac6213ee2f03bc70ccfd10234..36ca2193dec0c6e5237615c3a87bce663ef8288a 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/dec.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/dec.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x26ffcdbd233a53e7ca4612f2b02e1f2c1d885c3177e7n, r: 0x26ffcdbd233a53e7ca4612f2b02e1f2c1d885c3177e6n diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/div.js b/implementation-contributed/v8/mjsunit/harmony/bigint/div.js index 1eeea1184ff84c10b39b76042e663fdb0d0b380e..8b167140defe93c5b3dadabd57eb0d91558c89c1 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/div.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/div.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: -0x1e0f357314bac34227333c0c2086430dae88cb538f161174888591n, b: 0x390n, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/exp.js b/implementation-contributed/v8/mjsunit/harmony/bigint/exp.js index 54d5849373f5006049672b7c9be62891a33805e6..7fbc2dc402fb84f73e4d6d1e7df9c8ca448c0db6 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/exp.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/exp.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --harmony-bigint +// Flags: --allow-natives-syntax assertEquals(1n, (-1n) ** 0n); assertEquals(-1n, (-1n) ** 1n); diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/inc.js b/implementation-contributed/v8/mjsunit/harmony/bigint/inc.js index 4ead89e1bf4e9152cd00933bfcb4d3aeb4c82690..7842600393519db61de1a110866402623b3e475e 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/inc.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/inc.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0xb3df90n, r: 0xb3df91n diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/json.js b/implementation-contributed/v8/mjsunit/harmony/bigint/json.js index eb0eefc4bb7d2988fae734cecfa3cc3ae841a994..cf392234c5c960ce6382dc663b56baa890c151ad 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/json.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/json.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --harmony-bigint +// Flags: --allow-natives-syntax 'use strict' diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/mod.js b/implementation-contributed/v8/mjsunit/harmony/bigint/mod.js index c8cc7fa4fd2a25effd1960fcd10eb0130e72802b..01f64ad4ca9c706b6406286db8737f0b350c6ef0 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/mod.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/mod.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0xaed3c714bb42a73d708bcf1dc9a9deebadc913ef42bac6a6178a60n, b: -0xf3d6bd1c059b79n, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/mul.js b/implementation-contributed/v8/mjsunit/harmony/bigint/mul.js index c6a9ae6148918c05f08a25a7b96a80d619f1b160..77c3a1c9bbfcabee669abba1519abc4cbbfe4cf0 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/mul.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/mul.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x2bf1f236c2df29f7c99be052dfe1b69ae158d777fea487af889f6259f472c0n, b: -0xae0090dfn, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/neg.js b/implementation-contributed/v8/mjsunit/harmony/bigint/neg.js index 2fedf297a52483abe3fb00b61b8c457905403fea..15b2fb4ee0e379398d7b364e22b93d83092d0988 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/neg.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/neg.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0xcn, r: -0xcn diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/not.js b/implementation-contributed/v8/mjsunit/harmony/bigint/not.js index 6b4b2eb713d146d70f0aa4427637ec9f4c5e87c3..27b6a78ba6fd502029b0b3fe80a8ca7769dff4ed 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/not.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/not.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x9f0305cd75e4n, r: -0x9f0305cd75e5n diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/or.js b/implementation-contributed/v8/mjsunit/harmony/bigint/or.js index c378e141cd4cd833c489f6e8311e7678fe125aeb..3203258c21bc0d3356d2233203dbe92b941493fe 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/or.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/or.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x77a87n, b: 0xde08e7433fb9584911b8cb4bc7eed802299b4489fc635974d063847da4e8b461df5dn, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/regress-tonumbercode.js b/implementation-contributed/v8/mjsunit/harmony/bigint/regress-tonumbercode.js index 4dedf4d27c76fdf694d98b18ac7c6679e9edd157..3bf0148c95f9ba71c929b74fa70eb7f658aac628 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/regress-tonumbercode.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/regress-tonumbercode.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --harmony-bigint +// Flags: --allow-natives-syntax function f(x, b) { if (b) return Math.trunc(+(x)) diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/regressions.js b/implementation-contributed/v8/mjsunit/harmony/bigint/regressions.js index c1df45a1b1702f7f80d06bd49df750b7ce4e2d51..8e13622eab7c18d482ea6a1d06ec56fcbbf5126e 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/regressions.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/regressions.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-bigint - var a = 5n; var b = a / -1n; assertEquals(5n, a); diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/sar.js b/implementation-contributed/v8/mjsunit/harmony/bigint/sar.js index f66115dcb6c9a78b126d396a460a84f549d13f99..66d2f2d268157b710f5577091476eab38197c7c8 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/sar.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/sar.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0x211a34fn, b: 0xa6n, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/shl.js b/implementation-contributed/v8/mjsunit/harmony/bigint/shl.js index bedd785b544630ab94101ed783851d090380ecf3..0e7b402bc17288d32ab0784ea9878de22b389ced 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/shl.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/shl.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: -0xe813d76adc0a177778c0c232c595e8572b783210f4a7009d7c1787n, b: 0x9en, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/sub.js b/implementation-contributed/v8/mjsunit/harmony/bigint/sub.js index a1ff9b4bb334c5a4b23951c7c8b7501113bb42e2..21613f768a75124c85c77b7958c9d584e59d7c11 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/sub.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/sub.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: 0xc4fd438551d58edn, b: 0x91b42ee55a50d974an, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/tonumber.js b/implementation-contributed/v8/mjsunit/harmony/bigint/tonumber.js index d59e8429b891c8c51ed01c4288359168e9c35334..a6f7d13b7eb08083572e980ae9a59fc1a022983c 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/tonumber.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/tonumber.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-bigint - function Check(bigint, number_string) { var number = Number(bigint); if (number_string.substring(0, 2) === "0x") { diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/turbo.js b/implementation-contributed/v8/mjsunit/harmony/bigint/turbo.js index 4ce4880f3de5a0cd658c1ebf5a230be14b80ff0d..d0f00050c896ef9dd9843ea2ea3834671bd03958 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/turbo.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/turbo.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax --harmony-bigint +// Flags: --allow-natives-syntax 'use strict' diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/typedarray.js b/implementation-contributed/v8/mjsunit/harmony/bigint/typedarray.js index 29713b8a204d2a1b5b67c31ef6a29b6f1456e4ba..e530441dd455cbb7424c42faa33e178324ee58f6 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/typedarray.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/typedarray.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-bigint --allow-natives-syntax +// Flags: --allow-natives-syntax var intarray = new BigInt64Array(8); var uintarray = new BigUint64Array(8); diff --git a/implementation-contributed/v8/mjsunit/harmony/bigint/xor.js b/implementation-contributed/v8/mjsunit/harmony/bigint/xor.js index a934825bd979eb080c9abe3dcfd644ae0e800150..cf32b656033e3a570a0ee0d9e7dd2520473a3f61 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigint/xor.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigint/xor.js @@ -4,8 +4,6 @@ // Generated by tools/bigint-tester.py. -// Flags: --harmony-bigint - var data = [{ a: -0x46505bec40d461c595b5e4be178b7d00n, b: -0x9170e5437d4e3ec7c0971e2c6d3bbbd2929ff108ea4ee64f7a91aa367fn, diff --git a/implementation-contributed/v8/mjsunit/harmony/bigintarray-keyedstore-tobigint.js b/implementation-contributed/v8/mjsunit/harmony/bigintarray-keyedstore-tobigint.js index 29b44472c9b0b0bbfbdcae24a6a2d4e649e66125..18ba0ff1718a64abaa658fee3ba42af157735594 100644 --- a/implementation-contributed/v8/mjsunit/harmony/bigintarray-keyedstore-tobigint.js +++ b/implementation-contributed/v8/mjsunit/harmony/bigintarray-keyedstore-tobigint.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-bigint - let TypedArrayConstructors = [ BigUint64Array, BigInt64Array, diff --git a/implementation-contributed/v8/mjsunit/harmony/function-tostring.js b/implementation-contributed/v8/mjsunit/harmony/function-tostring.js index 4a7e93cd3bb7de6f108b2e65d1e6b7f56819f14a..2af14f16cf488c5a92c2a6070a32aa379e6371ba 100644 --- a/implementation-contributed/v8/mjsunit/harmony/function-tostring.js +++ b/implementation-contributed/v8/mjsunit/harmony/function-tostring.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-function-tostring - var prefix = "/*before*/"; var suffix = "/*after*/"; diff --git a/implementation-contributed/v8/mjsunit/regress/regress-319722-ArrayBuffer.js b/implementation-contributed/v8/mjsunit/regress/regress-319722-ArrayBuffer.js index 9a24fc5c7c32ef6d8665d147ab7a7393fcafc2ae..4a48a61ab38516903ce2f1879e1360f2cfbe4b21 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-319722-ArrayBuffer.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-319722-ArrayBuffer.js @@ -26,7 +26,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Flags: --nostress-opt --allow-natives-syntax --mock-arraybuffer-allocator -var maxSize = %_MaxSmi() + 1; +var maxSize = %MaxSmi() + 1; var ab; // Allocate the largest ArrayBuffer we can on this architecture. diff --git a/implementation-contributed/v8/mjsunit/regress/regress-319722-TypedArrays.js b/implementation-contributed/v8/mjsunit/regress/regress-319722-TypedArrays.js index e497aecbe0f79b054fb18059630161e47f764778..0445e2d2cf0dd4a5494b42daa50381d905c73e07 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-319722-TypedArrays.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-319722-TypedArrays.js @@ -27,7 +27,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Flags: --nostress-opt --allow-natives-syntax -var maxSize = %_MaxSmi() + 1; +var maxSize = %MaxSmi() + 1; function TestArray(constr) { assertThrows(function() { new constr(maxSize); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-707066.js b/implementation-contributed/v8/mjsunit/regress/regress-707066.js index b33b585ebdbd05fd721e1be9878967736faab301..b5d70c2e6b1f7cda42734638a6c4e344a2c4a6a0 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-707066.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-707066.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Flags: --harmony-function-tostring - // There was a bug in CreateDynamicFunction where a stack overflow // situation caused an assertion failure. diff --git a/implementation-contributed/v8/mjsunit/regress/regress-8237.js b/implementation-contributed/v8/mjsunit/regress/regress-8237.js new file mode 100644 index 0000000000000000000000000000000000000000..c3abd17e8a9646abfcbc85da9a1bade94b4599a3 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-8237.js @@ -0,0 +1,57 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-always-opt +// Files: test/mjsunit/code-coverage-utils.js + +%DebugToggleBlockCoverage(true); + +TestCoverage( +"Repro for the bug", +` +function lib (n) { // 0000 + if (n >= 0) { // 0050 + if (n < 0) { // 0100 + return; // 0150 + } // 0200 + } else if (foo()) { // 0250 + } // 0300 +} // 0350 +function foo () { // 0400 + console.log('foo') // 0450 + return false // 0500 +} // 0550 +lib(1) // 0600 +`, +[{"start":0,"end":649,"count":1}, +{"start":0,"end":351,"count":1}, +{"start":115,"end":205,"count":0}, +{"start":253,"end":303,"count":0}, +{"start":400,"end":551,"count":0}] +); + +TestCoverage( +"Variant with omitted brackets", +` +function lib (n) { // 0000 + if (n >= 0) { // 0050 + if (n < 0) // 0100 + return; // 0150 + } // 0200 + else if (foo()); // 0250 +} // 0300 +function foo () { // 0350 + console.log('foo') // 0400 + return false // 0450 +} // 0500 +lib(1) // 0550 +`, +[{"start":0,"end":599,"count":1}, +{"start":0,"end":301,"count":1}, +{"start":156,"end":163,"count":0}, +{"start":203,"end":268,"count":0}, +{"start":350,"end":501,"count":0}] +); + +%DebugToggleBlockCoverage(false); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-8265.js b/implementation-contributed/v8/mjsunit/regress/regress-8265.js new file mode 100644 index 0000000000000000000000000000000000000000..ffe6191c9f45b35fa6d81d56252899cc57ebfbd5 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-8265.js @@ -0,0 +1,12 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --random-seed=1 + +for (let i = 0; i < 54; ++i) Math.random(); +let sum = 0; +for (let i = 0; i < 10; ++i) + sum += Math.floor(Math.random() * 50); + +assertNotEquals(0, sum); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-890553.js b/implementation-contributed/v8/mjsunit/regress/regress-890553.js new file mode 100644 index 0000000000000000000000000000000000000000..33f13e8f26b9d0ff13963fd47a5785603f5a212a --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-890553.js @@ -0,0 +1,11 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +"use strict"; +var s = "function __f_9(func, testName) {" + + "var __v_0 = function __f_10(__v_14, __v_14) {" + + " return __v_16;" + + "}; " + +"}" +assertThrows(function() { eval(s); }); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-890243.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-890243.js new file mode 100644 index 0000000000000000000000000000000000000000..0d889b27873703c56e5e74079ab4b4ad1f250bad --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-890243.js @@ -0,0 +1,27 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +// We need a SpeculativeNumberAdd with Number feedback. +function bar(x) { return x + x; } +bar(0.1); + +// We also need an indirection via an object field such +// that only after escape analysis TurboFan can figure +// out that the value `y` is actually a Number in the +// safe integer range. +function baz(y) { return {y}; } +baz(null); baz(0); + +// Now we can put all of that together to get a kRepBit +// use of a kWord64 value (on 64-bit architectures). +function foo(o) { + return !baz(bar(o.x)).y; +} + +assertFalse(foo({x:1})); +assertFalse(foo({x:1})); +%OptimizeFunctionOnNextCall(foo); +assertFalse(foo({x:1})); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-891627.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-891627.js new file mode 100644 index 0000000000000000000000000000000000000000..afe4093c96c37685d52d9510f3c9a857e1ac2c1f --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-891627.js @@ -0,0 +1,43 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +// We need a NumberModulus, so we make sure that we have a +// SpeculativeNumberModulus with Number feedback, and later +// on use it with known Number inputs (via the bitwise or), +// such that JSTypedLowering turns it into the NumberModulus. +function bar(x) { return x % 2; } +bar(0.1); + +// Check that the Word32->Float64 conversion works properly. +(function() { + function foo(x) { + // The NumberEqual identifies 0 and -0. + return bar(x | -1) == 4294967295; + } + + assertFalse(foo(1)); + assertFalse(foo(0)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(1)); + assertFalse(foo(0)); +})(); + +// Check that the Word32->Word32 conversion works properly. +(function() { + function makeFoo(y) { + return function foo(x) { + return bar(x | -1) == y; + } + } + makeFoo(0); // Defeat the function context specialization. + const foo = makeFoo(1); + + assertFalse(foo(1)); + assertFalse(foo(0)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(1)); + assertFalse(foo(0)); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-892472-1.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-892472-1.js new file mode 100644 index 0000000000000000000000000000000000000000..d6332fd3991156747c36e1ff8d0c5ebad9d36068 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-892472-1.js @@ -0,0 +1,9 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --async-stack-traces + +const a = /x/; +a.exec = RegExp.prototype.test; +assertThrows(() => RegExp.prototype.test.call(a)); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-892472-2.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-892472-2.js new file mode 100644 index 0000000000000000000000000000000000000000..0f9a2c18164d1d87671a10d6253e7be0786a286e --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-892472-2.js @@ -0,0 +1,7 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --async-stack-traces + +assertThrows(_ => '' + {toString: Object.prototype.toLocaleString}); diff --git a/implementation-contributed/v8/mjsunit/smi-mul.js b/implementation-contributed/v8/mjsunit/smi-mul.js index 12d206abec7871713e1e504a5e9969ed1f041705..de10d3c3fb5f983a28a17a62cceb29198bee63ed 100644 --- a/implementation-contributed/v8/mjsunit/smi-mul.js +++ b/implementation-contributed/v8/mjsunit/smi-mul.js @@ -27,41 +27,34 @@ // Flags: --allow-natives-syntax --opt --noalways-opt -function mul(a, b) { - return a * b; -} - - -mul(-1, 2); -mul(-1, 2); -%OptimizeFunctionOnNextCall(mul); -assertEquals(-2, mul(-1, 2)); -assertOptimized(mul); - -// Deopt on minus zero. -assertEquals(-0, mul(-1, 0)); -assertUnoptimized(mul); - - -function mul2(a, b) { - return a * b; -} - -mul2(-1, 2); -mul2(-1, 2); -%OptimizeFunctionOnNextCall(mul2); - -// 2^30 is a smi boundary on arm and ia32. -var two_30 = 1 << 30; -// 2^31 is a smi boundary on x64. -var two_31 = 2 * two_30; - -if (%IsValidSmi(two_31)) { - // Deopt on two_31 on x64. - assertEquals(two_31, mul2(-two_31, -1)); - assertUnoptimized(mul2); -} else { - // Deopt on two_30 on ia32. - assertEquals(two_30, mul2(-two_30, -1)); +(function() { + function mul(a, b) { + return a * b; + } + + mul(-1, 2); + mul(-1, 2); + %OptimizeFunctionOnNextCall(mul); + assertEquals(-2, mul(-1, 2)); + assertOptimized(mul); + + // Deopt on minus zero. + assertEquals(-0, mul(-1, 0)); + assertUnoptimized(mul); +})(); + +(function() { + function mul2(a, b) { + return a * b; + } + + mul2(-1, 2); + mul2(-1, 2); + %OptimizeFunctionOnNextCall(mul2); + assertEquals(-2, mul2(-1, 2)); + assertOptimized(mul2); + + // Deopt on 2^31. + assertEquals(1 << 31, mul2(-(1 << 31), -1)); assertUnoptimized(mul2); -} +})(); diff --git a/implementation-contributed/v8/mjsunit/string-trim.js b/implementation-contributed/v8/mjsunit/string-trim.js index 201a34f1c9660704592807f5aff0b3c8f77358fc..587e7db5dbea9478726b829981e3ae8db4e93925 100644 --- a/implementation-contributed/v8/mjsunit/string-trim.js +++ b/implementation-contributed/v8/mjsunit/string-trim.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-string-trimming - assertEquals('trim', String.prototype.trim.name); assertEquals('trimStart', String.prototype.trimStart.name); assertEquals('trimStart', String.prototype.trimLeft.name); diff --git a/implementation-contributed/v8/test262/test262.status b/implementation-contributed/v8/test262/test262.status index c6f0e34e6dbe0727f15e59029942b84071e24b51..860e57a30bec8c5b466e3a26fe907b0fdfc0019a 100644 --- a/implementation-contributed/v8/test262/test262.status +++ b/implementation-contributed/v8/test262/test262.status @@ -364,9 +364,6 @@ 'language/global-code/script-decl-func-err-non-configurable': [FAIL], 'language/global-code/script-decl-var-collision': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=4958 - 'built-ins/Function/prototype/toString/*': ['--harmony-function-tostring'], - # https://bugs.chromium.org/p/v8/issues/detail?id=5116 'built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan': [PASS, FAIL], @@ -563,27 +560,43 @@ 'intl402/Collator/prototype/compare/bound-to-collator-instance': [SKIP], 'intl402/Collator/ignore-invalid-unicode-ext-values': [SKIP], - # https://bugs.chromium.org/p/v8/issues/detail?id=7684 + # https://bugs.chromium.org/p/v8/issues/detail?id=8260 + 'intl402/Locale/constructor-non-iana-canon': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8261 + 'intl402/Locale/constructor-options-language-valid': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8262 + 'intl402/Locale/constructor-parse-twice': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8259 + 'intl402/Locale/subclassing': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8246 + 'intl402/Locale/constructor-tag': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8244 'intl402/Locale/constructor-getter-order': [FAIL], 'intl402/Locale/constructor-locale-object': [FAIL], - 'intl402/Locale/constructor-non-iana-canon': [FAIL], 'intl402/Locale/constructor-options-language-grandfathered': [FAIL], 'intl402/Locale/constructor-options-language-invalid': [FAIL], - 'intl402/Locale/constructor-options-language-valid': [FAIL], 'intl402/Locale/constructor-options-region-invalid': [FAIL], 'intl402/Locale/constructor-options-region-valid': [FAIL], 'intl402/Locale/constructor-options-script-invalid': [FAIL], 'intl402/Locale/constructor-options-script-valid': [FAIL], - 'intl402/Locale/constructor-parse-twice': [FAIL], - 'intl402/Locale/constructor-tag': [FAIL], - 'intl402/Locale/constructor-unicode-ext-invalid': [FAIL], - 'intl402/Locale/extensions-grandfathered': [FAIL], - 'intl402/Locale/extensions-private': [FAIL], 'intl402/Locale/getters': [FAIL], - 'intl402/Locale/getters-grandfathered': [FAIL], - 'intl402/Locale/getters-privateuse': [FAIL], 'intl402/Locale/invalid-tag-throws': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8243 + 'intl402/Locale/extensions-private': [FAIL], + 'intl402/Locale/getters-privateuse': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8236 'intl402/Locale/likely-subtags': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8242 + 'intl402/Locale/extensions-grandfathered': [FAIL], + 'intl402/Locale/getters-grandfathered': [FAIL], 'intl402/Locale/likely-subtags-grandfathered': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=6705 @@ -616,6 +629,22 @@ 'built-ins/Atomics/wait/cannot-suspend-throws': [SKIP], 'built-ins/Atomics/wait/undefined-index-defaults-to-zero': [SKIP], + # https://bugs.chromium.org/p/v8/issues/detail?id=6890#c12 + 'built-ins/RegExp/prototype/Symbol.matchAll/isregexp-called-once': [FAIL], + 'built-ins/RegExp/prototype/Symbol.matchAll/species-constructor': [FAIL], + 'built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-global-throws': [FAIL], + 'built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-unicode-throws': [FAIL], + 'built-ins/String/prototype/matchAll/regexp-prototype-has-no-matchAll': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8258 + 'intl402/DateTimeFormat/constructor-options-throwing-getters': [FAIL], + 'intl402/Locale/constructor-options-language-valid-undefined': [FAIL], + 'intl402/Locale/constructor-options-throwing-getters': [FAIL], + 'intl402/Locale/constructor-tag-tostring': [FAIL], + 'intl402/NumberFormat/prototype/format/format-fraction-digits-precision': [FAIL], + 'intl402/NumberFormat/prototype/format/format-significant-digits-precision': [FAIL], + 'intl402/NumberFormat/prototype/formatToParts/value-tonumber': [FAIL], + ##################### DELIBERATE INCOMPATIBILITIES ##################### # https://github.com/tc39/ecma262/pull/889 @@ -643,6 +672,10 @@ ############################ INVALID TESTS ############################# + # https://github.com/tc39/test262/pull/1816#issuecomment-426799415 + # https://github.com/tc39/test262/pull/1818 + 'language/reserved-words/unreserved-words': [PASS, FAIL], + # Test makes unjustified assumptions about the number of calls to SortCompare. # Test262 Bug: https://bugs.ecmascript.org/show_bug.cgi?id=596 'built-ins/Array/prototype/sort/bug_596_1': [PASS, FAIL_OK], @@ -713,6 +746,28 @@ 'language/statements/class/fields-same-line-async-method-static-private-methods-with-fields': [FAIL], 'language/statements/class/fields-same-line-gen-static-private-methods-with-fields': [FAIL], + # https://github.com/tc39/test262/issues/1817 + 'language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-close': [FAIL], + 'language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close': [FAIL], + 'language/expressions/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted': [FAIL], + 'language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close': [FAIL], + 'language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close': [FAIL], + 'language/expressions/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id': [FAIL], + 'language/expressions/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted': [FAIL], + 'language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter': [FAIL], + 'language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable': [FAIL], + 'language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj': [FAIL], + 'language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-close': [FAIL], + 'language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close': [FAIL], + 'language/statements/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted': [FAIL], + 'language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close': [FAIL], + 'language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close': [FAIL], + 'language/statements/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id': [FAIL], + 'language/statements/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted': [FAIL], + 'language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter': [FAIL], + 'language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable': [FAIL], + 'language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj': [FAIL], + ############################ SLOW TESTS ############################# 'annexB/built-ins/RegExp/RegExp-leading-escape-BMP': [PASS, SLOW], diff --git a/implementation-contributed/v8/test262/testcfg.py b/implementation-contributed/v8/test262/testcfg.py index bb3114e64f9faf7879bdb92b2025e07fbdffac91..105f6713f28106a1b8c20b86b38c1af4cb79e727 100644 --- a/implementation-contributed/v8/test262/testcfg.py +++ b/implementation-contributed/v8/test262/testcfg.py @@ -42,7 +42,6 @@ from testrunner.outproc import test262 # TODO(littledan): move the flag mapping into the status file FEATURE_FLAGS = { - 'BigInt': '--harmony-bigint', 'class-fields-public': '--harmony-public-fields', 'class-static-fields-public': '--harmony-class-fields', 'Array.prototype.flat': '--harmony-array-flat', @@ -53,12 +52,13 @@ FEATURE_FLAGS = { 'Intl.ListFormat': '--harmony-intl-list-format', 'Intl.Locale': '--harmony-locale', 'Intl.RelativeTimeFormat': '--harmony-intl-relative-time-format', + 'Intl.Segmenter': '--harmony-intl-segmenter', 'Symbol.prototype.description': '--harmony-symbol-description', 'globalThis': '--harmony-global', + 'well-formed-json-stringify': '--harmony-json-stringify', } -SKIPPED_FEATURES = set(['Intl.Segmenter', - 'Object.fromEntries', +SKIPPED_FEATURES = set(['Object.fromEntries', 'export-star-as-namespace-from-module', 'class-fields-private', 'class-static-fields-private', diff --git a/src/dynamic-import/assignment-expr-not-optional.case b/src/dynamic-import/assignment-expr-not-optional.case new file mode 100644 index 0000000000000000000000000000000000000000..e10f5986a042ce4d7b9e0af545a22f70d36b0aac --- /dev/null +++ b/src/dynamic-import/assignment-expr-not-optional.case @@ -0,0 +1,14 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: It's a SyntaxError if AssignmentExpression is omitted +template: syntax/invalid +info: | + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ +//- import +import() +//- teardown +/* The params region intentionally empty */ diff --git a/src/dynamic-import/catch/nested-arrow.template b/src/dynamic-import/catch/nested-arrow.template new file mode 100644 index 0000000000000000000000000000000000000000..96aa28b1035bff5b4286525c0de304ef2d58b270 --- /dev/null +++ b/src/dynamic-import/catch/nested-arrow.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-arrow-import-catch- +name: nested arrow +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +let f = () => { + import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +}; + +f(); diff --git a/src/dynamic-import/catch/nested-async-function-await.template b/src/dynamic-import/catch/nested-async-function-await.template new file mode 100644 index 0000000000000000000000000000000000000000..fb62d11290dbefacc6c91fc8c3d58befd47531c3 --- /dev/null +++ b/src/dynamic-import/catch/nested-async-function-await.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-async-function-await- +name: nested in async function, awaited +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +async function f() { + await import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +} + +f(); diff --git a/src/dynamic-import/catch/nested-async-function-return-await.template b/src/dynamic-import/catch/nested-async-function-return-await.template new file mode 100644 index 0000000000000000000000000000000000000000..75b81e0dc2fbfc183b6e3852a9e16061551da3d7 --- /dev/null +++ b/src/dynamic-import/catch/nested-async-function-return-await.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-async-function-return-await- +name: nested in async function, returns awaited +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +async function f() { + return await import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +} + +f(); diff --git a/src/dynamic-import/catch/nested-async-function.template b/src/dynamic-import/catch/nested-async-function.template new file mode 100644 index 0000000000000000000000000000000000000000..3a2ae552836cfeee826f41672d3c10e67109b786 --- /dev/null +++ b/src/dynamic-import/catch/nested-async-function.template @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-async-function- +name: nested in async function +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +async function f() { + import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +} + +f(); + diff --git a/src/dynamic-import/catch/nested-block-labeled.template b/src/dynamic-import/catch/nested-block-labeled.template new file mode 100644 index 0000000000000000000000000000000000000000..ad857641b128e2ef3c1bd950446e11fcab53695a --- /dev/null +++ b/src/dynamic-import/catch/nested-block-labeled.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-block-labeled- +name: nested block syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +label: { + import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +}; diff --git a/src/dynamic-import/catch/nested-block.template b/src/dynamic-import/catch/nested-block.template new file mode 100644 index 0000000000000000000000000000000000000000..47254e57fe2ad59b45fa5eca435120e230e1fcfc --- /dev/null +++ b/src/dynamic-import/catch/nested-block.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-block-import-catch- +name: nested block +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +{ + import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +}; diff --git a/src/dynamic-import/catch/nested-do-while.template b/src/dynamic-import/catch/nested-do-while.template new file mode 100644 index 0000000000000000000000000000000000000000..ffda5199d9712a880691ad1f27d4ae83272099ad --- /dev/null +++ b/src/dynamic-import/catch/nested-do-while.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-do-while- +name: nested do while syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +do { + import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +} while (false); diff --git a/src/dynamic-import/catch/nested-else.template b/src/dynamic-import/catch/nested-else.template new file mode 100644 index 0000000000000000000000000000000000000000..cc36621adaa324bf1eb108a38ab4da06e61b935e --- /dev/null +++ b/src/dynamic-import/catch/nested-else.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-else-import-catch- +name: nested else +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +if (false) { + +} else { + import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +} diff --git a/src/dynamic-import/catch/nested-function.template b/src/dynamic-import/catch/nested-function.template new file mode 100644 index 0000000000000000000000000000000000000000..febdb2d6394d131c9f4e045003bbb4496188d23d --- /dev/null +++ b/src/dynamic-import/catch/nested-function.template @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-function-import-catch- +name: nested function +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +function f() { + import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +} +f(); diff --git a/src/dynamic-import/catch/nested-if.template b/src/dynamic-import/catch/nested-if.template new file mode 100644 index 0000000000000000000000000000000000000000..78b4f1968713f5670f3b82376a4753dbd3e506d7 --- /dev/null +++ b/src/dynamic-import/catch/nested-if.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-if-import-catch- +name: nested if +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +if (true) { + import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +} diff --git a/src/dynamic-import/catch/nested-while.template b/src/dynamic-import/catch/nested-while.template new file mode 100644 index 0000000000000000000000000000000000000000..341572885a806549a7374513f3295dcb9fc03133 --- /dev/null +++ b/src/dynamic-import/catch/nested-while.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/nested-while-import-catch- +name: nested while +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +let x = 0; +while (!x) { + x++; + import(/*{ params }*/).catch(error => { + + /*{ body }*/ + + }).then($DONE, $DONE); +}; diff --git a/src/dynamic-import/catch/top-level.template b/src/dynamic-import/catch/top-level.template new file mode 100644 index 0000000000000000000000000000000000000000..ee26cf4d7b283e041547d3d0d1399058a5f8aae1 --- /dev/null +++ b/src/dynamic-import/catch/top-level.template @@ -0,0 +1,31 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/catch/top-level-import-catch- +name: top level +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +import(/*{ params }*/).catch(error => { + + /*{ body }*/ + +}).then($DONE, $DONE); diff --git a/src/dynamic-import/default/nested-arrow-assign-expr.template b/src/dynamic-import/default/nested-arrow-assign-expr.template new file mode 100644 index 0000000000000000000000000000000000000000..7d6d90aa8e8eaba943471772d3c0b2b13fd0cb01 --- /dev/null +++ b/src/dynamic-import/default/nested-arrow-assign-expr.template @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-arrow-assignment-expression- +name: nested arrow +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +let f = () => import(/*{ params }*/).then(imported => { + + /*{ body }*/ + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/default/nested-arrow.template b/src/dynamic-import/default/nested-arrow.template new file mode 100644 index 0000000000000000000000000000000000000000..061526cac5f036ea3672a8db3e3312cdccd7cb56 --- /dev/null +++ b/src/dynamic-import/default/nested-arrow.template @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-arrow-import-then- +name: nested arrow +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +let f = () => { + return import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/src/dynamic-import/default/nested-async-function-await.template b/src/dynamic-import/default/nested-async-function-await.template new file mode 100644 index 0000000000000000000000000000000000000000..7e561c6ae1b83e3f880dacd90aa12ac13afa534c --- /dev/null +++ b/src/dynamic-import/default/nested-async-function-await.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-async-function-await- +name: nested in async function, awaited +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +async function f() { + await import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/default/nested-async-function-return-await.template b/src/dynamic-import/default/nested-async-function-return-await.template new file mode 100644 index 0000000000000000000000000000000000000000..55e85c71ee81c229858e7321047a2acf0a97e061 --- /dev/null +++ b/src/dynamic-import/default/nested-async-function-return-await.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-async-function-return-await- +name: nested in async function, returns awaited +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +async function f() { + return await import(/*{ params }*/); +} + +f().then(imported => { + + /*{ body }*/ + +}).then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/default/nested-async-function.template b/src/dynamic-import/default/nested-async-function.template new file mode 100644 index 0000000000000000000000000000000000000000..f83da4142f1f7a978cb3cfd59d9cdb92a69fb4c1 --- /dev/null +++ b/src/dynamic-import/default/nested-async-function.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-async-function- +name: nested in async function +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +async function f() { + import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/src/dynamic-import/default/nested-block-labeled.template b/src/dynamic-import/default/nested-block-labeled.template new file mode 100644 index 0000000000000000000000000000000000000000..71e8125919f352a23d4252ec0228d0fa948536f2 --- /dev/null +++ b/src/dynamic-import/default/nested-block-labeled.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/syntax-nested-block-labeled- +name: nested block syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +label: { + import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/src/dynamic-import/default/nested-block.template b/src/dynamic-import/default/nested-block.template new file mode 100644 index 0000000000000000000000000000000000000000..ebfce21e35d358654e0d0d4fd170282dde675af6 --- /dev/null +++ b/src/dynamic-import/default/nested-block.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-block-import-then- +name: nested block +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +{ + import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/src/dynamic-import/default/nested-do-while.template b/src/dynamic-import/default/nested-do-while.template new file mode 100644 index 0000000000000000000000000000000000000000..902b3236e9fb2232fd3d5fd731189618ae7d11a1 --- /dev/null +++ b/src/dynamic-import/default/nested-do-while.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-do-while- +name: nested do while syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +do { + import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/src/dynamic-import/default/nested-else.template b/src/dynamic-import/default/nested-else.template new file mode 100644 index 0000000000000000000000000000000000000000..b26a128e16df70eb2b17cefc3c5fbbaba1b2004f --- /dev/null +++ b/src/dynamic-import/default/nested-else.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-else-import-then- +name: nested else +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +if (false) { + +} else { + import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/src/dynamic-import/default/nested-function.template b/src/dynamic-import/default/nested-function.template new file mode 100644 index 0000000000000000000000000000000000000000..48e60f4bfc70fb2f88d189ed697d2ed585a6d895 --- /dev/null +++ b/src/dynamic-import/default/nested-function.template @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-function-import-then- +name: nested function +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +function f() { + import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/src/dynamic-import/default/nested-if-braceless.template b/src/dynamic-import/default/nested-if-braceless.template new file mode 100644 index 0000000000000000000000000000000000000000..907dd35e9eababaf4eca6a1677a7644a1ec53e6f --- /dev/null +++ b/src/dynamic-import/default/nested-if-braceless.template @@ -0,0 +1,31 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-if-braceless- +name: nested if syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +if (true) import(/*{ params }*/).then(imported => { + + /*{ body }*/ + +}).then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/default/nested-if.template b/src/dynamic-import/default/nested-if.template new file mode 100644 index 0000000000000000000000000000000000000000..c8fb0c83e6c2af48b289f3f6ba15f776e7125456 --- /dev/null +++ b/src/dynamic-import/default/nested-if.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-if-import-then- +name: nested if +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +if (true) { + import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/src/dynamic-import/default/nested-while.template b/src/dynamic-import/default/nested-while.template new file mode 100644 index 0000000000000000000000000000000000000000..fa2a103a2f6205bf0090e14e5bb145ee3dedb6e3 --- /dev/null +++ b/src/dynamic-import/default/nested-while.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/nested-while-import-then- +name: nested while +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +let x = 0; +while (!x) { + x++; + import(/*{ params }*/).then(imported => { + + /*{ body }*/ + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/src/dynamic-import/default/top-level.template b/src/dynamic-import/default/top-level.template new file mode 100644 index 0000000000000000000000000000000000000000..9982059a0992d06d78a460615cf34791c27a06a5 --- /dev/null +++ b/src/dynamic-import/default/top-level.template @@ -0,0 +1,31 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/usage/top-level-import-then- +name: top level +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +flags: [async] +---*/ + +import(/*{ params }*/).then(imported => { + + /*{ body }*/ + +}).then($DONE, $DONE).catch($DONE); diff --git a/src/dynamic-import/empty-str-is-valid-assign-expr.case b/src/dynamic-import/empty-str-is-valid-assign-expr.case new file mode 100644 index 0000000000000000000000000000000000000000..4f88699afbd0c27dce690cd30cd4b993177c29f4 --- /dev/null +++ b/src/dynamic-import/empty-str-is-valid-assign-expr.case @@ -0,0 +1,10 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: Calling import('') +template: syntax/valid +---*/ + +//- import +import('') diff --git a/src/dynamic-import/eval-gtbndng-indirect-update-dflt.case b/src/dynamic-import/eval-gtbndng-indirect-update-dflt.case new file mode 100644 index 0000000000000000000000000000000000000000..ae7310a5b01271a33cfbb8c12c7f0fc7b2ed04dc --- /dev/null +++ b/src/dynamic-import/eval-gtbndng-indirect-update-dflt.case @@ -0,0 +1,27 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Modifications to default binding that occur after dependency has been + evaluated are reflected in local binding +info: | + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +template: default +---*/ + +//- params +'./eval-gtbndng-indirect-update-dflt_FIXTURE.js' +//- body +assert.sameValue(imported.default(), 1); +assert.sameValue(imported.default, 2); diff --git a/src/dynamic-import/eval-gtbndng-indirect-update.case b/src/dynamic-import/eval-gtbndng-indirect-update.case new file mode 100644 index 0000000000000000000000000000000000000000..030b53291411bbd0dec4804f93d59491d9930322 --- /dev/null +++ b/src/dynamic-import/eval-gtbndng-indirect-update.case @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Modifications to named bindings that occur after dependency has been + evaluated are reflected in local binding +esid: sec-moduleevaluation +info: | + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). +includes: [fnGlobalObject.js] +template: default +---*/ + +//- params +'./eval-gtbndng-indirect-update_FIXTURE.js' +//- body +assert.sameValue(imported.x, 1); + +// This function is exposed on the global scope (instead of as an exported +// binding) in order to avoid possible false positives from assuming correct +// behavior of the semantics under test. +fnGlobalObject().test262update(); + +assert.sameValue(imported.x, 2); + diff --git a/src/dynamic-import/eval-rqstd-abrupt-typeerror.case b/src/dynamic-import/eval-rqstd-abrupt-typeerror.case new file mode 100644 index 0000000000000000000000000000000000000000..371b0d680043e44f62cf600c964cdea89fc27efe --- /dev/null +++ b/src/dynamic-import/eval-rqstd-abrupt-typeerror.case @@ -0,0 +1,20 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Abrupt completion during module evaluation precludes further evaluation +esid: sec-moduleevaluation +info: | + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). +template: catch +---*/ + +//- params +'./eval-rqstd-abrupt-err-type_FIXTURE.js' +//- body +assert.sameValue(error.name, 'TypeError'); diff --git a/src/dynamic-import/eval-rqstd-abrupt-urierror.case b/src/dynamic-import/eval-rqstd-abrupt-urierror.case new file mode 100644 index 0000000000000000000000000000000000000000..bff657b556e0e30203c8cce0c76a5ac740a9d365 --- /dev/null +++ b/src/dynamic-import/eval-rqstd-abrupt-urierror.case @@ -0,0 +1,20 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + Abrupt completion during module evaluation precludes further evaluation +esid: sec-moduleevaluation +info: | + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). +template: catch +---*/ + +//- params +'./eval-rqstd-abrupt-err-uri_FIXTURE.js' +//- body +assert.sameValue(error.name, 'URIError'); diff --git a/src/dynamic-import/instn-iee-err-ambiguous-import.case b/src/dynamic-import/instn-iee-err-ambiguous-import.case new file mode 100644 index 0000000000000000000000000000000000000000..184744db3f33af53884bb28e82a8aaf384a0b38a --- /dev/null +++ b/src/dynamic-import/instn-iee-err-ambiguous-import.case @@ -0,0 +1,40 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: IndirectExportEntries validation - ambiguous imported bindings +esid: sec-moduledeclarationinstantiation +info: | + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". +template: catch +---*/ + +//- params +'./instn-iee-err-ambiguous-export_FIXTURE.js' +//- body +assert.sameValue(error.name, 'SyntaxError'); diff --git a/src/dynamic-import/instn-iee-err-circular.case b/src/dynamic-import/instn-iee-err-circular.case new file mode 100644 index 0000000000000000000000000000000000000000..6b34395f17aa71880c9ba8a4fb92e64c8a4cb0b3 --- /dev/null +++ b/src/dynamic-import/instn-iee-err-circular.case @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: IndirectExportEntries validation - circular imported bindings +esid: sec-moduledeclarationinstantiation +info: | + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. +template: catch +---*/ + +//- params +'./instn-iee-err-circular-1_FIXTURE.js' +//- body +assert.sameValue(error.name, 'SyntaxError'); diff --git a/src/dynamic-import/returns-promise.case b/src/dynamic-import/returns-promise.case new file mode 100644 index 0000000000000000000000000000000000000000..0160b0704de9183a98e1e85cfd599974f005ba2d --- /dev/null +++ b/src/dynamic-import/returns-promise.case @@ -0,0 +1,12 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: Dynamic import() returns a Promise object. +template: default +---*/ + +//- params +'./dynamic-import-module_FIXTURE.js' +//- body +assert.sameValue(imported.x, 1); diff --git a/src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template b/src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template new file mode 100644 index 0000000000000000000000000000000000000000..98ee16f6a1c89cd50bfe0f2040e04c876bd178d2 --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template @@ -0,0 +1,31 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +let f = () => /*{ import }*/; diff --git a/src/dynamic-import/syntax/invalid/nested-arrow.template b/src/dynamic-import/syntax/invalid/nested-arrow.template new file mode 100644 index 0000000000000000000000000000000000000000..5a50736bae763a2b1b30289b7c1b68a6949d22d6 --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-arrow.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-arrow- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +let f = () => { + /*{ import }*/; +}; diff --git a/src/dynamic-import/syntax/invalid/nested-async-function-await.template b/src/dynamic-import/syntax/invalid/nested-async-function-await.template new file mode 100644 index 0000000000000000000000000000000000000000..4d433c2b1f0508e0dfcbf01ce89f4a609959579e --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-async-function-await.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-async-function-await- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + await /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/invalid/nested-async-function-return-await.template b/src/dynamic-import/syntax/invalid/nested-async-function-return-await.template new file mode 100644 index 0000000000000000000000000000000000000000..34c7097634621567ab5bbcc348acee290bae764d --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-async-function-return-await.template @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + return await /*{ import }*/; +} + diff --git a/src/dynamic-import/syntax/invalid/nested-async-function.template b/src/dynamic-import/syntax/invalid/nested-async-function.template new file mode 100644 index 0000000000000000000000000000000000000000..d84cc931edea39d3924579850f3a1787ef7a5f96 --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-async-function.template @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-async-function- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + /*{ import }*/; +} + diff --git a/src/dynamic-import/syntax/invalid/nested-block-labeled.template b/src/dynamic-import/syntax/invalid/nested-block-labeled.template new file mode 100644 index 0000000000000000000000000000000000000000..2c37acf00882df555a819ec3971bbac7b8759101 --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-block-labeled.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-block-labeled- +name: nested block syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +label: { + /*{ import }*/; +}; diff --git a/src/dynamic-import/syntax/invalid/nested-block.template b/src/dynamic-import/syntax/invalid/nested-block.template new file mode 100644 index 0000000000000000000000000000000000000000..d569536bb9b182f364db6140b6e0b82e310f762e --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-block.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-block- +name: nested block syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +{ + /*{ import }*/; +}; diff --git a/src/dynamic-import/syntax/invalid/nested-do-while.template b/src/dynamic-import/syntax/invalid/nested-do-while.template new file mode 100644 index 0000000000000000000000000000000000000000..73e567579d51455c3a5220b47f5cadb43f58daae --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-do-while.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-do-while- +name: nested do while syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +do { + /*{ import }*/; +} while (false); diff --git a/src/dynamic-import/syntax/invalid/nested-else-braceless.template b/src/dynamic-import/syntax/invalid/nested-else-braceless.template new file mode 100644 index 0000000000000000000000000000000000000000..61989c9b593a7df1a19766f4166bc257ffadc919 --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-else-braceless.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-else-braceless- +name: nested else syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (false) { + +} else /*{ import }*/; diff --git a/src/dynamic-import/syntax/invalid/nested-else.template b/src/dynamic-import/syntax/invalid/nested-else.template new file mode 100644 index 0000000000000000000000000000000000000000..14017d2c5e1a3771b8625d563a0fe4f8262193e6 --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-else.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-else- +name: nested else syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (false) { + +} else { + /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/invalid/nested-function-return.template b/src/dynamic-import/syntax/invalid/nested-function-return.template new file mode 100644 index 0000000000000000000000000000000000000000..1590943656cdf40e32c8816de85f3b77d416a6c1 --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-function-return.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-function-return- +name: nested function syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function fn() { + return /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/invalid/nested-function.template b/src/dynamic-import/syntax/invalid/nested-function.template new file mode 100644 index 0000000000000000000000000000000000000000..e81ddf9c9aa66d8f9967bcab9f39f7e738a05d9c --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-function.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-function- +name: nested function syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function fn() { + /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/invalid/nested-if-braceless.template b/src/dynamic-import/syntax/invalid/nested-if-braceless.template new file mode 100644 index 0000000000000000000000000000000000000000..7f51cb411b9cb75a27d811ad2d6444aef1366443 --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-if-braceless.template @@ -0,0 +1,31 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-if-braceless- +name: nested if syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (true) /*{ import }*/; diff --git a/src/dynamic-import/syntax/invalid/nested-if.template b/src/dynamic-import/syntax/invalid/nested-if.template new file mode 100644 index 0000000000000000000000000000000000000000..830eab471b025d4d06cbbb6463cdbcac8f58d54d --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-if.template @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-if- +name: nested if syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (true) { + /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/invalid/nested-while.template b/src/dynamic-import/syntax/invalid/nested-while.template new file mode 100644 index 0000000000000000000000000000000000000000..daeb7b4a447d5642feba19a29c80b43390a02477 --- /dev/null +++ b/src/dynamic-import/syntax/invalid/nested-while.template @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/nested-while- +name: nested while syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +let x = 0; +while (!x) { + x++; + /*{ import }*/; +}; diff --git a/src/dynamic-import/syntax/invalid/top-level.template b/src/dynamic-import/syntax/invalid/top-level.template new file mode 100644 index 0000000000000000000000000000000000000000..c85c6393ebc57c599eefbdec79b04e75215e228f --- /dev/null +++ b/src/dynamic-import/syntax/invalid/top-level.template @@ -0,0 +1,21 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/invalid/top-level- +name: top level syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + +flags: [module] +features: [dynamic-import] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +/*{ import }*/; diff --git a/src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template b/src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template new file mode 100644 index 0000000000000000000000000000000000000000..1e3b61b9d5ada4716d1c963c0b84e6eb122eaf1d --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template @@ -0,0 +1,26 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +---*/ + +let f = () => /*{ import }*/; diff --git a/src/dynamic-import/syntax/valid/nested-arrow.template b/src/dynamic-import/syntax/valid/nested-arrow.template new file mode 100644 index 0000000000000000000000000000000000000000..f906eaa4dd1de93639cc8d51f69f290711ca2624 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-arrow.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-arrow- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +let f = () => { + /*{ import }*/; +}; diff --git a/src/dynamic-import/syntax/valid/nested-async-function-await.template b/src/dynamic-import/syntax/valid/nested-async-function-await.template new file mode 100644 index 0000000000000000000000000000000000000000..0480ab68fda99065f4ac65978d71feabd702d335 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-async-function-await.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-async-function-await- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +async function f() { + await /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/valid/nested-async-function-return-await.template b/src/dynamic-import/syntax/valid/nested-async-function-return-await.template new file mode 100644 index 0000000000000000000000000000000000000000..d9063ca78f55f21910170a651c3b75b387652bef --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-async-function-return-await.template @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +async function f() { + return await /*{ import }*/; +} + diff --git a/src/dynamic-import/syntax/valid/nested-async-function.template b/src/dynamic-import/syntax/valid/nested-async-function.template new file mode 100644 index 0000000000000000000000000000000000000000..f358c16314566d1fcf6fc127d81461b268251d84 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-async-function.template @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-async-function- +name: nested arrow syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +async function f() { + /*{ import }*/; +} + diff --git a/src/dynamic-import/syntax/valid/nested-block-labeled.template b/src/dynamic-import/syntax/valid/nested-block-labeled.template new file mode 100644 index 0000000000000000000000000000000000000000..970edc5fb7805d1de5f93140ab1087ea622a6f83 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-block-labeled.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-block-labeled- +name: nested block syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +label: { + /*{ import }*/; +}; diff --git a/src/dynamic-import/syntax/valid/nested-block.template b/src/dynamic-import/syntax/valid/nested-block.template new file mode 100644 index 0000000000000000000000000000000000000000..38e23565162dd9059e1cf146cf12957963ce19c6 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-block.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-block- +name: nested block syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +{ + /*{ import }*/; +}; diff --git a/src/dynamic-import/syntax/valid/nested-do-while.template b/src/dynamic-import/syntax/valid/nested-do-while.template new file mode 100644 index 0000000000000000000000000000000000000000..a269d99144a2cddca4293a3b1be2ab27eeec856b --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-do-while.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-do-while- +name: nested do while syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +do { + /*{ import }*/; +} while (false); diff --git a/src/dynamic-import/syntax/valid/nested-else-braceless.template b/src/dynamic-import/syntax/valid/nested-else-braceless.template new file mode 100644 index 0000000000000000000000000000000000000000..86948d93027255caa641f42b8a49ffcb67be71a9 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-else-braceless.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-else-braceless- +name: nested else syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +if (false) { + +} else /*{ import }*/; diff --git a/src/dynamic-import/syntax/valid/nested-else.template b/src/dynamic-import/syntax/valid/nested-else.template new file mode 100644 index 0000000000000000000000000000000000000000..1f93708b692cff40108c74e62aa6a4c9f696e49e --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-else.template @@ -0,0 +1,30 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-else- +name: nested else syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +if (false) { + +} else { + /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/valid/nested-function-return.template b/src/dynamic-import/syntax/valid/nested-function-return.template new file mode 100644 index 0000000000000000000000000000000000000000..db04a04757e54297c28c37b36f171b06939e7e9c --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-function-return.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-function-return- +name: nested function syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +---*/ + +function fn() { + return /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/valid/nested-function.template b/src/dynamic-import/syntax/valid/nested-function.template new file mode 100644 index 0000000000000000000000000000000000000000..8fd7eff00dce5e181c62ac57c9c947eafcaf8fa9 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-function.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-function- +name: nested function syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +---*/ + +function fn() { + /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/valid/nested-if-braceless.template b/src/dynamic-import/syntax/valid/nested-if-braceless.template new file mode 100644 index 0000000000000000000000000000000000000000..0cd924889fd8bd33ee1ee3fd0b773f347bb53a22 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-if-braceless.template @@ -0,0 +1,26 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-if-braceless- +name: nested if syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +if (true) /*{ import }*/; diff --git a/src/dynamic-import/syntax/valid/nested-if.template b/src/dynamic-import/syntax/valid/nested-if.template new file mode 100644 index 0000000000000000000000000000000000000000..5cebc7a6281d20e9929f310973ffc1962b4e71fd --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-if.template @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-if- +name: nested if syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + +features: [dynamic-import] +---*/ + +if (true) { + /*{ import }*/; +} diff --git a/src/dynamic-import/syntax/valid/nested-while.template b/src/dynamic-import/syntax/valid/nested-while.template new file mode 100644 index 0000000000000000000000000000000000000000..ac2cd12bf151a4e3e503c4b2a1752ad62cf7bd96 --- /dev/null +++ b/src/dynamic-import/syntax/valid/nested-while.template @@ -0,0 +1,30 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/nested-while- +name: nested while syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +flags: [module] +features: [dynamic-import] +---*/ + +let x = 0; +while (!x) { + x++; + /*{ import }*/; +}; diff --git a/src/dynamic-import/syntax/valid/top-level.template b/src/dynamic-import/syntax/valid/top-level.template new file mode 100644 index 0000000000000000000000000000000000000000..33387103d8542a4d6c411b15b86086592f399cf2 --- /dev/null +++ b/src/dynamic-import/syntax/valid/top-level.template @@ -0,0 +1,16 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/module-code/dynamic-import/syntax/valid/top-level- +name: top level syntax +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall : + import( AssignmentExpression ) + +flags: [module] +features: [dynamic-import] +---*/ + +/*{ import }*/; diff --git a/src/function-forms/default/async-arrow-function.template b/src/function-forms/default/async-arrow-function.template index cdeec6f3e45065f0af39bbd575435f34c55d70b1..e1abe93442bebc3ca8a60287870cbcbfae62d8d6 100644 --- a/src/function-forms/default/async-arrow-function.template +++ b/src/function-forms/default/async-arrow-function.template @@ -26,6 +26,7 @@ info: | AsyncArrowHead : async ArrowFormalParameters flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/default/async-func-decl.template b/src/function-forms/default/async-func-decl.template index b9a21de58a29dddfd77073d00c4fa53b1a28581e..70971cdbc35a38891d992e037d80be656dd714de 100644 --- a/src/function-forms/default/async-func-decl.template +++ b/src/function-forms/default/async-func-decl.template @@ -11,6 +11,7 @@ info: | AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/default/async-func-expr-named.template b/src/function-forms/default/async-func-expr-named.template index daf87b2f1f6a088aed9fa66b74716aa979d035fd..e475de3912b3ee4c328eb3b80e5123d7a3f96fd6 100644 --- a/src/function-forms/default/async-func-expr-named.template +++ b/src/function-forms/default/async-func-expr-named.template @@ -11,6 +11,7 @@ info: | AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/default/async-func-expr-nameless.template b/src/function-forms/default/async-func-expr-nameless.template index cade1a007f50698cc34640fa6ce272c726e2e9f1..a3e984da1acc1dd9e87f4ff08b81a30fa54800b5 100644 --- a/src/function-forms/default/async-func-expr-nameless.template +++ b/src/function-forms/default/async-func-expr-nameless.template @@ -11,6 +11,7 @@ info: | AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/default/async-meth.template b/src/function-forms/default/async-meth.template index 7e0d3d9ee15d772446a0a5ff8275c7e52da84fd1..a666b23ed90168f0c786beaa72246916a1374f0d 100644 --- a/src/function-forms/default/async-meth.template +++ b/src/function-forms/default/async-meth.template @@ -11,6 +11,7 @@ info: | AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/default/cls-decl-async-meth-static.template b/src/function-forms/default/cls-decl-async-meth-static.template index 70e1bd38b4021a94e47e3295e5a4d8cbb3dd78e6..b745a86a41677cf4b95b1a31661edbdc848ea880 100644 --- a/src/function-forms/default/cls-decl-async-meth-static.template +++ b/src/function-forms/default/cls-decl-async-meth-static.template @@ -35,6 +35,7 @@ info: | scope, strict). [...] flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/default/cls-decl-async-meth.template b/src/function-forms/default/cls-decl-async-meth.template index a646af8834e2af7a6adbb42caeb8b9526cdcb570..812cd4aba65b198dfb669de13ba5b7f4863de784 100644 --- a/src/function-forms/default/cls-decl-async-meth.template +++ b/src/function-forms/default/cls-decl-async-meth.template @@ -35,6 +35,7 @@ info: | scope, strict). [...] flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/default/cls-expr-async-meth-static.template b/src/function-forms/default/cls-expr-async-meth-static.template index 0d5214165b24de60f45de33b2f45dc9c50fffc0d..d558633a618956326ae8ad8baff3d4279a0a02e8 100644 --- a/src/function-forms/default/cls-expr-async-meth-static.template +++ b/src/function-forms/default/cls-expr-async-meth-static.template @@ -35,6 +35,7 @@ info: | scope, strict). [...] flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/default/cls-expr-async-meth.template b/src/function-forms/default/cls-expr-async-meth.template index 58c351c57314569537e36a9ff94ecffcfef550db..0590f67c011e4c54b3347065a64e76e78babc54f 100644 --- a/src/function-forms/default/cls-expr-async-meth.template +++ b/src/function-forms/default/cls-expr-async-meth.template @@ -35,6 +35,7 @@ info: | scope, strict). [...] flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/error/async-arrow-function.template b/src/function-forms/error/async-arrow-function.template index a64737742cab8f751a851bbe4a1969ccc32fd1bd..96d6119c75f12896de192976e73d4cc396130c8c 100644 --- a/src/function-forms/error/async-arrow-function.template +++ b/src/function-forms/error/async-arrow-function.template @@ -26,6 +26,7 @@ info: | AsyncArrowHead : async ArrowFormalParameters flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/error/async-func-decl.template b/src/function-forms/error/async-func-decl.template index 35057673eaa757a0e15e0df8edb720cd9f8751fe..a7a5a856161d556bca8b651449ceacaae3f7a850 100644 --- a/src/function-forms/error/async-func-decl.template +++ b/src/function-forms/error/async-func-decl.template @@ -11,6 +11,7 @@ info: | AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/error/async-func-expr-named.template b/src/function-forms/error/async-func-expr-named.template index 142d6ae79ff091229084271744ca4464dcf3d4f3..32a639bba90e507d8e624895270f083d62ee5c49 100644 --- a/src/function-forms/error/async-func-expr-named.template +++ b/src/function-forms/error/async-func-expr-named.template @@ -11,6 +11,7 @@ info: | AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/error/async-func-expr-nameless.template b/src/function-forms/error/async-func-expr-nameless.template index 40d5dc04149a509845de800b2c058e01aa5b7114..9843f5bdb80906618f43fd4b6ac58de1fb9c3c7e 100644 --- a/src/function-forms/error/async-func-expr-nameless.template +++ b/src/function-forms/error/async-func-expr-nameless.template @@ -11,6 +11,7 @@ info: | AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/error/async-meth.template b/src/function-forms/error/async-meth.template index 315f7ace49e4daa1d92d5abcafb23dc2111b9835..4c77b04408ec155e3d7005587cf668151b25b0b9 100644 --- a/src/function-forms/error/async-meth.template +++ b/src/function-forms/error/async-meth.template @@ -11,6 +11,7 @@ info: | AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/error/cls-decl-async-meth-static.template b/src/function-forms/error/cls-decl-async-meth-static.template index 2056b336af2f7b4214cfa52518528f785c929cec..b3f9941e2f78a7abdd2261057a7a19f5f92c7183 100644 --- a/src/function-forms/error/cls-decl-async-meth-static.template +++ b/src/function-forms/error/cls-decl-async-meth-static.template @@ -35,6 +35,7 @@ info: | scope, strict). [...] flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/error/cls-decl-async-meth.template b/src/function-forms/error/cls-decl-async-meth.template index 4a119e4971480c86168688f07090de06f10dcdfd..9ee782999db870fb0f140628f54515e01ca98c2b 100644 --- a/src/function-forms/error/cls-decl-async-meth.template +++ b/src/function-forms/error/cls-decl-async-meth.template @@ -35,6 +35,7 @@ info: | scope, strict). [...] flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/error/cls-expr-async-meth-static.template b/src/function-forms/error/cls-expr-async-meth-static.template index e64dc3276db4229eb873666feb5c36176a19b3fb..33e35a56f352027f13191ac90b66dc8b0ba48dae 100644 --- a/src/function-forms/error/cls-expr-async-meth-static.template +++ b/src/function-forms/error/cls-expr-async-meth-static.template @@ -36,6 +36,7 @@ info: | scope, strict). [...] flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/error/cls-expr-async-meth.template b/src/function-forms/error/cls-expr-async-meth.template index e77de2411760c26a2101ce51e1943868e97dae15..45dc7335dd141b8b812699512df6d29d5bb3b536 100644 --- a/src/function-forms/error/cls-expr-async-meth.template +++ b/src/function-forms/error/cls-expr-async-meth.template @@ -36,6 +36,7 @@ info: | scope, strict). [...] flags: [async] +features: [async-functions] ---*/ var callCount = 0; diff --git a/src/function-forms/syntax/async-func-decl.template b/src/function-forms/syntax/async-func-decl.template index 6f5beb08969ba91c72c6a02244e643efb2b89c4e..457274876566c4a2688ffcd3918f9238143ecac6 100644 --- a/src/function-forms/syntax/async-func-decl.template +++ b/src/function-forms/syntax/async-func-decl.template @@ -10,6 +10,7 @@ info: | AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } +features: [async-functions] ---*/ async function f(/*{ params }*/) { diff --git a/src/function-forms/syntax/async-func-expr-named.template b/src/function-forms/syntax/async-func-expr-named.template index b7efe5fc91223484952885e72620d3cb44c6a4c8..0c6c2737d1f332497263e8f7b02924812dea27f9 100644 --- a/src/function-forms/syntax/async-func-expr-named.template +++ b/src/function-forms/syntax/async-func-expr-named.template @@ -10,7 +10,7 @@ info: | AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } - +features: [async-functions] ---*/ (async function f(/*{ params }*/) { diff --git a/src/function-forms/syntax/async-func-expr-nameless.template b/src/function-forms/syntax/async-func-expr-nameless.template index 206fc5018f6cfe152e7932e71f156225731ea6f3..59356dec73d834e1f2e73666d7c94b6d6c44ed29 100644 --- a/src/function-forms/syntax/async-func-expr-nameless.template +++ b/src/function-forms/syntax/async-func-expr-nameless.template @@ -10,6 +10,7 @@ info: | AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } +features: [async-functions] ---*/ (async function(/*{ params }*/) { diff --git a/src/generators/default/class-decl-private-method.template b/src/generators/default/class-decl-private-method.template index 933dcfcbb600fa53d105f9085383edefc783a116..9676db57905404bc853f0b9f48ce5e9c34e7474f 100644 --- a/src/generators/default/class-decl-private-method.template +++ b/src/generators/default/class-decl-private-method.template @@ -1,7 +1,7 @@ // Copyright (C) 2018 Bloomberg LP. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/statements/class/gen-method- +path: language/statements/class/gen-private-method- name: Generator private method as a ClassDeclaration element esid: prod-GeneratorPrivateMethod info: | diff --git a/test/built-ins/JSON/stringify/15.12.3-0-1.js b/test/built-ins/JSON/stringify/15.12.3-0-1.js index 5cc4240c7de4a8978159a4a92c34af4467935a33..7fa21c051c14b41113b5b5c3f2544f6a23f51fc6 100644 --- a/test/built-ins/JSON/stringify/15.12.3-0-1.js +++ b/test/built-ins/JSON/stringify/15.12.3-0-1.js @@ -4,19 +4,13 @@ /*--- info: | This test should be run without any built-ins being added/augmented. - The name JSON must be bound to an object. - Section 15 says that every built-in Function object described in this - section � whether as a constructor, an ordinary function, or both � has - a length property whose value is an integer. Unless otherwise specified, - this value is equal to the largest number of named arguments shown in - the section headings for the function description, including optional - parameters. - This default applies to JSON.stringify, and it must exist as a function - taking 3 parameters. + The initial value of [[Configurable]] on JSON is true. This means we + should be able to delete (8.6.2.5) the stringify and parse properties. es5id: 15.12.3-0-1 -description: JSON.stringify must exist as be a function +description: JSON.stringify must be deletable (configurable) ---*/ -var f = JSON.stringify; +var o = JSON; +var desc = Object.getOwnPropertyDescriptor(o, "stringify"); -assert.sameValue(typeof(f), "function", 'typeof(f)'); +assert.sameValue(desc.configurable, true, 'desc.configurable'); diff --git a/test/built-ins/JSON/stringify/15.12.3-0-2.js b/test/built-ins/JSON/stringify/15.12.3-0-2.js index 08e864d0c88bc6ef2746ac68d3b6f110b97a47e3..4c33fa73b8acf0fdfba11181931587dcdb71a09d 100644 --- a/test/built-ins/JSON/stringify/15.12.3-0-2.js +++ b/test/built-ins/JSON/stringify/15.12.3-0-2.js @@ -14,7 +14,7 @@ info: | This default applies to JSON.stringify, and it must exist as a function taking 3 parameters. es5id: 15.12.3-0-2 -description: JSON.stringify must exist as be a function taking 3 parameters +description: JSON.stringify must exist as a function taking 3 parameters ---*/ var f = JSON.stringify; diff --git a/test/built-ins/JSON/stringify/15.12.3-0-3.js b/test/built-ins/JSON/stringify/15.12.3-0-3.js deleted file mode 100644 index 76e41ffb8a45801e127182f5ae4d7d027ac93a56..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-0-3.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: | - This test should be run without any built-ins being added/augmented. - The initial value of [[Configurable]] on JSON is true. This means we - should be able to delete (8.6.2.5) the stringify and parse properties. -es5id: 15.12.3-0-3 -description: JSON.stringify must be deletable (configurable) ----*/ - -var o = JSON; -var desc = Object.getOwnPropertyDescriptor(o, "stringify"); - -assert.sameValue(desc.configurable, true, 'desc.configurable'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-16.js b/test/built-ins/JSON/stringify/15.12.3-11-16.js deleted file mode 100644 index 23f89c2f9ca8dccc38a465a228b7403dbfa666d7..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-16.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-16 -description: > - JSON.stringify - stringifying an object where property name is the - union of all null character (The abstract operation Quote(value) - step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F": "John" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-17.js b/test/built-ins/JSON/stringify/15.12.3-11-17.js deleted file mode 100644 index 9723236294182a0464b9ac6eaf531d35554f0f2f..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-17.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-17 -description: > - JSON.stringify - stringifying an object where property name starts - with the union of all null character (The abstract operation - Quote(value) step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fname": "John" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-18.js b/test/built-ins/JSON/stringify/15.12.3-11-18.js deleted file mode 100644 index 6766a4e199561889e0afa537c747ee8fd6d566c7..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-18.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-18 -description: > - JSON.stringify - stringifying an object where property name ends - with the union of all null character (The abstract operation - Quote(value) step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "name\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F": "John" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-19.js b/test/built-ins/JSON/stringify/15.12.3-11-19.js deleted file mode 100644 index 052e394f27c9aacab093d00282e603296533bb44..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-19.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-19 -description: > - JSON.stringify - stringifying an object where property name starts - and ends with the union of all null character (The abstract - operation Quote(value) step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fname\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F": "John" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1 && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-2.js b/test/built-ins/JSON/stringify/15.12.3-11-2.js index adc1c36c8835ff9acd22e499764d43bf74cd6a71..721a2fb8ec3d93d17723a52295ba23a04630157e 100644 --- a/test/built-ins/JSON/stringify/15.12.3-11-2.js +++ b/test/built-ins/JSON/stringify/15.12.3-11-2.js @@ -4,7 +4,7 @@ /*--- es5id: 15.12.3-11-2 description: > - A JSON.stringify replacer function works is applied to a top level + A JSON.stringify replacer function is applied to a top level undefined value. ---*/ diff --git a/test/built-ins/JSON/stringify/15.12.3-11-20.js b/test/built-ins/JSON/stringify/15.12.3-11-20.js deleted file mode 100644 index 8c9bc27838e03e85b909820697854d222a9c25c1..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-20.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-20 -description: > - JSON.stringify - stringifying an object where property name - middles with the union of all null character (The abstract - operation Quote(value) step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "na\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fme": "John" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-21.js b/test/built-ins/JSON/stringify/15.12.3-11-21.js deleted file mode 100644 index ca7e598d61c942a2738bb7386791f14257384823..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-21.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-21 -description: > - JSON.stringify - stringifying an object where property value is - the union of all null character (The abstract operation - Quote(value) step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "name": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-22.js b/test/built-ins/JSON/stringify/15.12.3-11-22.js deleted file mode 100644 index eec1325004d82a8c207601cfc4697c6be4613c4f..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-22.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-22 -description: > - JSON.stringify - stringifying an object where property value - starts with the union of all null character (The abstract - operation Quote(value) step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "name": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001FJohn" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-23.js b/test/built-ins/JSON/stringify/15.12.3-11-23.js deleted file mode 100644 index 982968f34db12bbf4fba31480f94bb9cc7da7256..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-23.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-23 -description: > - JSON.stringify - stringifying an object where property value ends - with the union of all null character (The abstract operation - Quote(value) step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "name": "John\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-24.js b/test/built-ins/JSON/stringify/15.12.3-11-24.js deleted file mode 100644 index 3fc4140a2c953b2a6ca0214912bfb5a190175001..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-24.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-24 -description: > - JSON.stringify - stringifying an object where property value - starts and ends with the union of all null character (The abstract - operation Quote(value) step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "name": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001FJohn\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1 && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-25.js b/test/built-ins/JSON/stringify/15.12.3-11-25.js deleted file mode 100644 index 9a26fa418138329b7ecb4d9ad94fb9372f9a0acb..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-25.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-25 -description: > - JSON.stringify - stringifying an object where property value - middles with the union of all null character (The abstract - operation Quote(value) step 2.c) ----*/ - -var result = true; - -var expectedNullChars = new Array(); -expectedNullChars[0] = "\\u0000"; -expectedNullChars[1] = "\\u0001"; -expectedNullChars[2] = "\\u0002"; -expectedNullChars[3] = "\\u0003"; -expectedNullChars[4] = "\\u0004"; -expectedNullChars[5] = "\\u0005"; -expectedNullChars[6] = "\\u0006"; -expectedNullChars[7] = "\\u0007"; -expectedNullChars[8] = "\\b"; -expectedNullChars[9] = "\\t"; -expectedNullChars[10] = "\\n"; -expectedNullChars[11] = "\\u000b"; -expectedNullChars[12] = "\\f"; -expectedNullChars[13] = "\\r"; -expectedNullChars[14] = "\\u000e"; -expectedNullChars[15] = "\\u000f"; -expectedNullChars[16] = "\\u0010"; -expectedNullChars[17] = "\\u0011"; -expectedNullChars[18] = "\\u0012"; -expectedNullChars[19] = "\\u0013"; -expectedNullChars[20] = "\\u0014"; -expectedNullChars[21] = "\\u0015"; -expectedNullChars[22] = "\\u0016"; -expectedNullChars[23] = "\\u0017"; -expectedNullChars[24] = "\\u0018"; -expectedNullChars[25] = "\\u0019"; -expectedNullChars[26] = "\\u001a"; -expectedNullChars[27] = "\\u001b"; -expectedNullChars[28] = "\\u001c"; -expectedNullChars[29] = "\\u001d"; -expectedNullChars[30] = "\\u001e"; -expectedNullChars[31] = "\\u001f"; - -for (var index in expectedNullChars) { - - var str = JSON.stringify({ - "name": "Jo\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001Fhn" - }); - result = (result && str.indexOf(expectedNullChars[index]) !== -1 && str.indexOf(expectedNullChars[index]) !== -1); -} - -assert(result, 'result !== true'); diff --git a/test/built-ins/JSON/stringify/15.12.3-11-26.js b/test/built-ins/JSON/stringify/15.12.3-11-26.js deleted file mode 100644 index 142160ce5d3f41542b96105fae6385568de24af3..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3-11-26.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3-11-26 -description: > - JSON.stringify - the last element of the concatenation is ']' (The - abstract operation JA(value) step 10.b.iii) ----*/ - -var arrObj = []; -arrObj[0] = "a"; -arrObj[1] = "b"; -arrObj[2] = "c"; - -var jsonText = JSON.stringify(arrObj, undefined, "").toString(); - -assert.sameValue(jsonText.charAt(jsonText.length - 1), "]", 'jsonText.charAt(jsonText.length - 1)'); diff --git a/test/built-ins/JSON/stringify/15.12.3_4-1-1.js b/test/built-ins/JSON/stringify/15.12.3_4-1-1.js index 40b42f57424a7a39b03bc1af9b8aa92481a9fa2d..636b52e563808963dbfa67e2de8525325e8b23b5 100644 --- a/test/built-ins/JSON/stringify/15.12.3_4-1-1.js +++ b/test/built-ins/JSON/stringify/15.12.3_4-1-1.js @@ -3,7 +3,7 @@ /*--- es5id: 15.12.3_4-1-1 -description: JSON.stringify a circular object throws a error +description: JSON.stringify of a circular object throws a TypeError ---*/ var obj = {}; diff --git a/test/built-ins/JSON/stringify/15.12.3_4-1-2.js b/test/built-ins/JSON/stringify/15.12.3_4-1-2.js index 299853c9164d41fd05d63bcf17e2fe28dbe766aa..dfd81c7d2a2342c57719a0e0863031ea2a14d5b3 100644 --- a/test/built-ins/JSON/stringify/15.12.3_4-1-2.js +++ b/test/built-ins/JSON/stringify/15.12.3_4-1-2.js @@ -3,11 +3,15 @@ /*--- es5id: 15.12.3_4-1-2 -description: JSON.stringify a circular object throws a TypeError +description: JSON.stringify of an indirectly circular object throws a TypeError ---*/ -var obj = {}; -obj.prop = obj; +var obj = { + p1: { + p2: {} + } +}; +obj.p1.p2.prop = obj; assert.throws(TypeError, function() { JSON.stringify(obj); diff --git a/test/built-ins/JSON/stringify/15.12.3_4-1-3.js b/test/built-ins/JSON/stringify/15.12.3_4-1-3.js deleted file mode 100644 index feb1a6c9c30ed52d16c9a1b31b2f9f4b7246895a..0000000000000000000000000000000000000000 --- a/test/built-ins/JSON/stringify/15.12.3_4-1-3.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.12.3_4-1-3 -description: JSON.stringify a indirectly circular object throws a error ----*/ - -var obj = { - p1: { - p2: {} - } -}; -obj.p1.p2.prop = obj; - -assert.throws(TypeError, function() { - JSON.stringify(obj); -}); diff --git a/test/built-ins/JSON/stringify/string-escape-ascii.js b/test/built-ins/JSON/stringify/string-escape-ascii.js new file mode 100644 index 0000000000000000000000000000000000000000..5751c43fdb832142035f175ef0a319f5bc51e461 --- /dev/null +++ b/test/built-ins/JSON/stringify/string-escape-ascii.js @@ -0,0 +1,66 @@ +// Copyright (c) 2018 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-quotejsonstring +description: > + JSON.stringify property names and values containing ASCII + characters that require escaping +---*/ + +var char_to_json = { + '"': '\\"', + "\\": "\\\\", + "\x00": "\\u0000", + "\x01": "\\u0001", + "\x02": "\\u0002", + "\x03": "\\u0003", + "\x04": "\\u0004", + "\x05": "\\u0005", + "\x06": "\\u0006", + "\x07": "\\u0007", + "\x08": "\\b", + "\x09": "\\t", + "\x0A": "\\n", + "\x0B": "\\u000b", + "\x0C": "\\f", + "\x0D": "\\r", + "\x0E": "\\u000e", + "\x0F": "\\u000f", + "\x10": "\\u0010", + "\x11": "\\u0011", + "\x12": "\\u0012", + "\x13": "\\u0013", + "\x14": "\\u0014", + "\x15": "\\u0015", + "\x16": "\\u0016", + "\x17": "\\u0017", + "\x18": "\\u0018", + "\x19": "\\u0019", + "\x1A": "\\u001a", + "\x1B": "\\u001b", + "\x1C": "\\u001c", + "\x1D": "\\u001d", + "\x1E": "\\u001e", + "\x1F": "\\u001f" +} + +var chars = Object.keys(char_to_json).join(""); +var chars_reversed = Object.keys(char_to_json).reverse().join(""); +var jsonChars = Object.values(char_to_json).join(""); +var jsonChars_reversed = Object.values(char_to_json).reverse().join(""); +var json = JSON.stringify({ + ["name" + chars + chars_reversed]: chars_reversed + chars + "value" +}); + +for (var char in char_to_json) { + var count = json.split(char_to_json[char]).length - 1; + assert.sameValue(count, 4, + "Every ASCII 0x" + char.charCodeAt(0).toString(16) + " serializes to " + char_to_json[char]); +} + +assert.sameValue( + json, + `{"${"name" + jsonChars + jsonChars_reversed}":"${jsonChars_reversed + jsonChars + "value"}"}`, + "JSON.stringify(objectUsingControlCharacters)" +); diff --git a/test/built-ins/JSON/stringify/string-escape-unicode.js b/test/built-ins/JSON/stringify/string-escape-unicode.js new file mode 100644 index 0000000000000000000000000000000000000000..6f35ba16a1d3cc4f88ab4dbc66eeabb6725f1a61 --- /dev/null +++ b/test/built-ins/JSON/stringify/string-escape-unicode.js @@ -0,0 +1,36 @@ +// Copyright (c) 2018 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-quotejsonstring +description: > + JSON.stringify strings containing surrogate code units +features: [well-formed-json-stringify] +---*/ + +assert.sameValue(JSON.stringify("\uD834"), '"\\ud834"', + 'JSON.stringify("\\uD834")'); +assert.sameValue(JSON.stringify("\uDF06"), '"\\udf06"', + 'JSON.stringify("\\uDF06")'); + +assert.sameValue(JSON.stringify("\uD834\uDF06"), '"𝌆"', + 'JSON.stringify("\\uD834\\uDF06")'); +assert.sameValue(JSON.stringify("\uD834\uD834\uDF06\uD834"), '"\\ud834𝌆\\ud834"', + 'JSON.stringify("\\uD834\\uD834\\uDF06\\uD834")'); +assert.sameValue(JSON.stringify("\uD834\uD834\uDF06\uDF06"), '"\\ud834𝌆\\udf06"', + 'JSON.stringify("\\uD834\\uD834\\uDF06\\uDF06")'); +assert.sameValue(JSON.stringify("\uDF06\uD834\uDF06\uD834"), '"\\udf06𝌆\\ud834"', + 'JSON.stringify("\\uDF06\\uD834\\uDF06\\uD834")'); +assert.sameValue(JSON.stringify("\uDF06\uD834\uDF06\uDF06"), '"\\udf06𝌆\\udf06"', + 'JSON.stringify("\\uDF06\\uD834\\uDF06\\uDF06")'); + +assert.sameValue(JSON.stringify("\uDF06\uD834"), '"\\udf06\\ud834"', + 'JSON.stringify("\\uDF06\\uD834")'); +assert.sameValue(JSON.stringify("\uD834\uDF06\uD834\uD834"), '"𝌆\\ud834\\ud834"', + 'JSON.stringify("\\uD834\\uDF06\\uD834\\uD834")'); +assert.sameValue(JSON.stringify("\uD834\uDF06\uD834\uDF06"), '"𝌆𝌆"', + 'JSON.stringify("\\uD834\\uDF06\\uD834\\uDF06")'); +assert.sameValue(JSON.stringify("\uDF06\uDF06\uD834\uD834"), '"\\udf06\\udf06\\ud834\\ud834"', + 'JSON.stringify("\\uDF06\\uDF06\\uD834\\uD834")'); +assert.sameValue(JSON.stringify("\uDF06\uDF06\uD834\uDF06"), '"\\udf06\\udf06𝌆"', + 'JSON.stringify("\\uDF06\\uDF06\\uD834\\uDF06")'); diff --git a/test/intl402/Collator/ignore-invalid-unicode-ext-values.js b/test/intl402/Collator/ignore-invalid-unicode-ext-values.js index e6c88ed3add5965dd3733a36dcb05329d23bd44e..28fe35e03e3112407896175c97f3d27c83177637 100644 --- a/test/intl402/Collator/ignore-invalid-unicode-ext-values.js +++ b/test/intl402/Collator/ignore-invalid-unicode-ext-values.js @@ -24,7 +24,7 @@ var defaultLocale = defaultOptions.locale; var defaultSortedArray = testArray.slice(0).sort(defaultCollator.compare); var keyValues = { - "co": ["standard", "search", "invalid"], + "co": ["standard", "search"], "ka": ["noignore", "shifted", "invalid"], "kb": ["true", "false", "invalid"], "kc": ["true", "false", "invalid"], diff --git a/test/intl402/DateTimeFormat/ignore-invalid-unicode-ext-values.js b/test/intl402/DateTimeFormat/ignore-invalid-unicode-ext-values.js index a6e6661323a981c644fd229db7e296d0a28357b5..37ba0c7b63d270ab21e56c1b4c4376dd2eb080ab 100644 --- a/test/intl402/DateTimeFormat/ignore-invalid-unicode-ext-values.js +++ b/test/intl402/DateTimeFormat/ignore-invalid-unicode-ext-values.js @@ -21,7 +21,7 @@ locales.forEach(function (locale) { var keyValues = { "cu": ["USD", "EUR", "JPY", "CNY", "TWD", "invalid"], // DateTimeFormat internally uses NumberFormat - "nu": ["native", "traditio", "finance", "invalid"], + "nu": ["native", "traditio", "finance"], "tz": ["usnavajo", "utcw01", "aumel", "uslax", "usnyc", "deber", "invalid"] }; diff --git a/test/intl402/Locale/constructor-locale-object.js b/test/intl402/Locale/constructor-locale-object.js index 201b19dfad741a0f4e082962a8f62c1d6ec6a1d9..3a21c6561336016519066de157f46c4537ee4134 100644 --- a/test/intl402/Locale/constructor-locale-object.js +++ b/test/intl402/Locale/constructor-locale-object.js @@ -15,15 +15,23 @@ features: [Intl.Locale] const enUS = new Intl.Locale("en-US"); const enGB = new Intl.Locale(enUS, {region: "GB"}); -assert.sameValue(enUS.toString(), "en-US"); -assert.sameValue(enGB.toString(), "en-GB"); +assert.sameValue(enUS.toString(), "en-US", 'enUS.toString() returns "en-US"'); +assert.sameValue(enGB.toString(), "en-GB", 'enGB.toString() returns "en-GB"'); // Pass Intl.Locale object and replace Unicode extension keyword. const zhUnihan = new Intl.Locale("zh-u-co-unihan"); const zhZhuyin = new Intl.Locale(zhUnihan, {collation: "zhuyin"}); -assert.sameValue(zhUnihan.toString(), "zh-u-co-unihan"); -assert.sameValue(zhZhuyin.toString(), "zh-u-co-zhuyin"); +assert.sameValue( + zhUnihan.toString(), + "zh-u-co-unihan", + 'zhUnihan.toString() returns "zh-u-co-unihan"' +); +assert.sameValue( + zhZhuyin.toString(), + "zh-u-co-zhuyin", + 'zhZhuyin.toString() returns "zh-u-co-zhuyin"' +); -assert.sameValue(zhUnihan.collation, "unihan"); -assert.sameValue(zhZhuyin.collation, "zhuyin"); +assert.sameValue(zhUnihan.collation, "unihan", 'The value of zhUnihan.collation is "unihan"'); +assert.sameValue(zhZhuyin.collation, "zhuyin", 'The value of zhZhuyin.collation is "zhuyin"'); diff --git a/test/intl402/Locale/constructor-newtarget-undefined.js b/test/intl402/Locale/constructor-newtarget-undefined.js index e24be35be472cd26c504a2e7bd9254c2968be208..e8e542976d60339c609a6182776af514c4857d08 100644 --- a/test/intl402/Locale/constructor-newtarget-undefined.js +++ b/test/intl402/Locale/constructor-newtarget-undefined.js @@ -14,8 +14,8 @@ features: [Intl.Locale] assert.throws(TypeError, function() { Intl.Locale(); -}); +}, 'Intl.Locale() throws TypeError'); assert.throws(TypeError, function() { Intl.Locale("en"); -}); +}, 'Intl.Locale("en") throws TypeError'); diff --git a/test/intl402/Locale/constructor-non-iana-canon.js b/test/intl402/Locale/constructor-non-iana-canon.js index 715b08ccbc70497b07f2f851f7b43e6476718c1d..ded2af1c893c49190b0f0cc2dca4f05677599318 100644 --- a/test/intl402/Locale/constructor-non-iana-canon.js +++ b/test/intl402/Locale/constructor-non-iana-canon.js @@ -75,10 +75,26 @@ var testData = [ ]; for (const {tag, canonical = tag, maximized = canonical, minimized = canonical} of testData) { - assert.sameValue(Intl.getCanonicalLocales(tag)[0], canonical); + assert.sameValue( + Intl.getCanonicalLocales(tag)[0], + canonical, + 'The value of Intl.getCanonicalLocales(tag)[0] equals the value of `canonical`' + ); const loc = new Intl.Locale(tag); - assert.sameValue(loc.toString(), canonical); - assert.sameValue(loc.maximize().toString(), maximized); - assert.sameValue(loc.minimize().toString(), minimized); + assert.sameValue( + new Intl.Locale(tag).toString(), + canonical, + `new Intl.Locale("${tag}").toString() returns "${canonical}"` + ); + assert.sameValue( + new Intl.Locale(tag).maximize().toString(), + maximized, + `new Intl.Locale("${tag}").maximize().toString() returns "${maximized}"` + ); + assert.sameValue( + new Intl.Locale(tag).minimize().toString(), + minimized, + `new Intl.Locale("${tag}").minimize().toString() returns "${minimized}"` + ); } diff --git a/test/intl402/Locale/constructor-options-calendar-invalid.js b/test/intl402/Locale/constructor-options-calendar-invalid.js index 7722a2ecedcfe4db7e785f2572c82c2a882cec11..b0b02b8f88124f6b1581ea4887926569847f9776 100644 --- a/test/intl402/Locale/constructor-options-calendar-invalid.js +++ b/test/intl402/Locale/constructor-options-calendar-invalid.js @@ -29,8 +29,8 @@ const invalidCalendarOptions = [ "abcdefghi", "abc-abcdefghi", ]; -for (const invalidCalendarOption of invalidCalendarOptions) { +for (const calendar of invalidCalendarOptions) { assert.throws(RangeError, function() { - new Intl.Locale("en", {calendar: invalidCalendarOption}); - }, `${invalidCalendarOption} is an invalid calendar option value`); + new Intl.Locale("en", {calendar}); + }, `new Intl.Locale("en", {calendar: "${calendar}"}) throws RangeError`); } diff --git a/test/intl402/Locale/constructor-options-calendar-valid.js b/test/intl402/Locale/constructor-options-calendar-valid.js index fbd4f6d741dc4c75e5b31ca8f5ab3c10bf92f139..5701ac9846a3a0a97cab1ed28baaee18ad3eb381 100644 --- a/test/intl402/Locale/constructor-options-calendar-valid.js +++ b/test/intl402/Locale/constructor-options-calendar-valid.js @@ -28,15 +28,14 @@ const validCalendarOptions = [ ["1234abcd-abc123", "en-u-ca-1234abcd-abc123"], ]; for (const [calendar, expected] of validCalendarOptions) { - let options = { calendar }; assert.sameValue( - new Intl.Locale('en', options).toString(), + new Intl.Locale('en', { calendar }).toString(), expected, - `new Intl.Locale('en', options).toString() equals the value of ${expected}` + `new Intl.Locale('en', { calendar: "${calendar}" }).toString() returns "${expected}"` ); assert.sameValue( - new Intl.Locale('en-u-ca-gregory', options).toString(), + new Intl.Locale('en-u-ca-gregory', { calendar }).toString(), expected, - `new Intl.Locale('en-u-ca-gregory', options).toString() equals the value of ${expected}` + `new Intl.Locale('en-u-ca-gregory', { calendar: "${calendar}" }).toString() returns "${expected}"` ); } diff --git a/test/intl402/Locale/constructor-options-casefirst-invalid.js b/test/intl402/Locale/constructor-options-casefirst-invalid.js index cf4b9c4524195789786e08d4afe4ac85effc3bf2..d4863bdd1ea09b581fe6a965d2687587f1c45604 100644 --- a/test/intl402/Locale/constructor-options-casefirst-invalid.js +++ b/test/intl402/Locale/constructor-options-casefirst-invalid.js @@ -30,8 +30,8 @@ const invalidCaseFirstOptions = [ "true", { valueOf() { return false; } }, ]; -for (const invalidCaseFirstOption of invalidCaseFirstOptions) { +for (const caseFirst of invalidCaseFirstOptions) { assert.throws(RangeError, function() { - new Intl.Locale("en", {caseFirst: invalidCaseFirstOption}); - }, `${invalidCaseFirstOption} is an invalid caseFirst option value`); + new Intl.Locale("en", {caseFirst}); + }, `new Intl.Locale("en", {caseFirst: "${caseFirst}"}) throws RangeError`); } diff --git a/test/intl402/Locale/constructor-options-casefirst-valid.js b/test/intl402/Locale/constructor-options-casefirst-valid.js index 391734a68c688153970c26903b775b098484781b..61848904c8975bc87d3fc58e879784c21c2a62d5 100644 --- a/test/intl402/Locale/constructor-options-casefirst-valid.js +++ b/test/intl402/Locale/constructor-options-casefirst-valid.js @@ -43,22 +43,24 @@ const validCaseFirstOptions = [ { toString() { return false; } }, ]; for (const caseFirst of validCaseFirstOptions) { - const options = { caseFirst }; const expected = String(caseFirst); + let expect = "en-u-kf-" + expected; assert.sameValue( - new Intl.Locale('en', options).toString(), - "en-u-kf-" + expected + new Intl.Locale('en', { caseFirst }).toString(), + expect, + `new Intl.Locale("en", { caseFirst: "${caseFirst}" }).toString() returns "${expect}"` ); + expect = "en-u-kf-" + expected; assert.sameValue( - new Intl.Locale('en-u-kf-lower', options).toString(), - "en-u-kf-" + expected + new Intl.Locale('en-u-kf-lower', { caseFirst }).toString(), + expect, + `new Intl.Locale("en-u-kf-lower", { caseFirst: "${caseFirst}" }).toString() returns "${expect}"` ); - if ("caseFirst" in Intl.Locale.prototype) { - assert.sameValue( - new Intl.Locale('en-u-kf-lower', options).caseFirst, - expected - ); - } + assert.sameValue( + new Intl.Locale('en-u-kf-lower', { caseFirst }).caseFirst, + expected, + `new Intl.Locale("en-u-kf-lower", { caseFirst }).caseFirst equals "${expected}"` + ); } diff --git a/test/intl402/Locale/constructor-options-collation-invalid.js b/test/intl402/Locale/constructor-options-collation-invalid.js index dadf41db1c46f0ea090524037f2e6b02298c18d0..c4e6868605f5a8e1969fcf401ac842ae44f10409 100644 --- a/test/intl402/Locale/constructor-options-collation-invalid.js +++ b/test/intl402/Locale/constructor-options-collation-invalid.js @@ -30,5 +30,5 @@ const invalidCollationOptions = [ for (const invalidCollationOption of invalidCollationOptions) { assert.throws(RangeError, function() { new Intl.Locale("en", {collation: invalidCollationOption}); - }, `${invalidCollationOption} is an invalid collation option value`); + }, '`new Intl.Locale("en", {collation: invalidCollationOption})` throws RangeError'); } diff --git a/test/intl402/Locale/constructor-options-collation-valid.js b/test/intl402/Locale/constructor-options-collation-valid.js index addfa9a16753fdccf3b7521fe03702b6c86c9f05..64521cc3abf17e55ea60454691160a464b53e935 100644 --- a/test/intl402/Locale/constructor-options-collation-valid.js +++ b/test/intl402/Locale/constructor-options-collation-valid.js @@ -48,15 +48,15 @@ const validCollationOptions = [ ["1234abcd-abc123", "en-u-co-1234abcd-abc123"], ]; for (const [collation, expected] of validCollationOptions) { - let options = { collation }; assert.sameValue( - new Intl.Locale('en', options).toString(), + new Intl.Locale('en', {collation}).toString(), expected, - `new Intl.Locale('en', options).toString() equals the value of ${expected}` + `new Intl.Locale('en', {collation: "${collation}"}).toString() returns "${expected}"` ); + assert.sameValue( - new Intl.Locale('en-u-co-gregory', options).toString(), + new Intl.Locale('en-u-co-gregory', {collation}).toString(), expected, - `new Intl.Locale('en-u-co-gregory', options).toString() equals the value of ${expected}` + `new Intl.Locale('en-u-co-gregory', {collation: "${collation}"}).toString() returns "${expected}"` ); } diff --git a/test/intl402/Locale/constructor-options-hourcycle-invalid.js b/test/intl402/Locale/constructor-options-hourcycle-invalid.js index 0749641d281fb6af39d89e4742b05385d44340eb..cce1139e585dbed98fa6bb733324b86e999694d8 100644 --- a/test/intl402/Locale/constructor-options-hourcycle-invalid.js +++ b/test/intl402/Locale/constructor-options-hourcycle-invalid.js @@ -36,8 +36,8 @@ const invalidHourCycleOptions = [ "h12\0", "H12", ]; -for (const invalidHourCycleOption of invalidHourCycleOptions) { +for (const hourCycle of invalidHourCycleOptions) { assert.throws(RangeError, function() { - new Intl.Locale("en", {hourCycle: invalidHourCycleOption}); - }, `${invalidHourCycleOption} is an invalid hourCycle option value`); + new Intl.Locale("en", {hourCycle}); + }, `new Intl.Locale("en", {hourCycle: "${hourCycle}"}) throws RangeError`); } diff --git a/test/intl402/Locale/constructor-options-hourcycle-valid.js b/test/intl402/Locale/constructor-options-hourcycle-valid.js index 42fc7e16ef6e18a54c3323507810649cb7554cf9..7875c87a1416a31c6f9fa93b1b3a0f79c6514c4f 100644 --- a/test/intl402/Locale/constructor-options-hourcycle-valid.js +++ b/test/intl402/Locale/constructor-options-hourcycle-valid.js @@ -43,31 +43,30 @@ const validHourCycleOptions = [ { toString() { return 'h24'; } }, ]; for (const hourCycle of validHourCycleOptions) { - const options = { hourCycle }; const expected = String(hourCycle); let expect = 'en-u-hc-' + expected; assert.sameValue( - new Intl.Locale('en', options).toString(), + new Intl.Locale('en', {hourCycle}).toString(), expect, - `new Intl.Locale('en', options).toString() equals the value of ${expect}` + `new Intl.Locale("en", {hourCycle: "${hourCycle}"}).toString() returns "${expect}"` ); assert.sameValue( - new Intl.Locale('en-u-hc-h00', options).toString(), + new Intl.Locale('en-u-hc-h00', {hourCycle}).toString(), expect, - `new Intl.Locale('en-u-hc-h00', options).toString() equals the value of ${expect}` + `new Intl.Locale("en-u-hc-h00", {hourCycle: "${hourCycle}"}).toString() returns "${expect}"` ); assert.sameValue( - new Intl.Locale('en-u-hc-h12', options).toString(), + new Intl.Locale('en-u-hc-h12', {hourCycle}).toString(), expect, - `new Intl.Locale('en-u-hc-h12', options).toString() equals the value of ${expect}` + `new Intl.Locale("en-u-hc-h12", {hourCycle: "${hourCycle}"}).toString() returns "${expect}"` ); assert.sameValue( - new Intl.Locale('en-u-hc-h00', options).hourCycle, + new Intl.Locale('en-u-hc-h00', {hourCycle}).hourCycle, expected, - `new Intl.Locale('en-u-hc-h00', options).hourCycle equals the value of ${expected}` + `new Intl.Locale("en-u-hc-h00", {hourCycle: "${hourCycle}"}).hourCycle equals "${expected}"` ); } diff --git a/test/intl402/Locale/constructor-options-language-grandfathered.js b/test/intl402/Locale/constructor-options-language-grandfathered.js index f3dfc8d11e6999f1fb536a1655c47d3ce4c22cf6..6d54a0bc95584af6b0b865d46b888c0295f4544b 100644 --- a/test/intl402/Locale/constructor-options-language-grandfathered.js +++ b/test/intl402/Locale/constructor-options-language-grandfathered.js @@ -4,39 +4,30 @@ /*--- esid: sec-intl.locale description: > - Checks error cases for the options argument to the Locale - constructor. + Checks error cases for the options argument to the Locale + constructor. info: | - ApplyOptionsToTag( tag, options ) - ... - 3. Let language be ? GetOption(options, "language", "string", undefined, undefined). - 4. If language is not undefined, then - a. If language does not match the language production, throw a RangeError exception. - b. If language matches the grandfathered production, throw a RangeError exception. - ... + ApplyOptionsToTag( tag, options ) + ... + 3. Let language be ? GetOption(options, "language", "string", undefined, undefined). + 4. If language is not undefined, then + a. If language does not match the language production, throw a RangeError exception. + b. If language matches the grandfathered production, throw a RangeError exception. + ... features: [Intl.Locale] ---*/ -const testData = [ - { - tag: "nb", - options: { - language: "no-bok", - }, - }, +assert.throws(RangeError, function() { + new Intl.Locale("nb", { + language: "no-bok", + }); +}, `new Intl.Locale("nb", {language: "no-bok"}) throws RangeError`); - { - tag: "nb", - options: { - language: "no-bok", - region: "NO", - }, - }, -]; +assert.throws(RangeError, function() { + new Intl.Locale("nb", { + language: "no-bok", + region: "NO", + }); +}, `new Intl.Locale("nb", {language: "no-bok", region: "NO"}) throws RangeError`); -for (const {tag, options} of testData) { - assert.throws(RangeError, function() { - new Intl.Locale(tag, options); - }); -} diff --git a/test/intl402/Locale/constructor-options-language-invalid.js b/test/intl402/Locale/constructor-options-language-invalid.js index 5c593becd8e891eec683ffb744a0e9607e425ba0..fcc424fbd1c422d2a5733fd0d7834317efb7e6da 100644 --- a/test/intl402/Locale/constructor-options-language-invalid.js +++ b/test/intl402/Locale/constructor-options-language-invalid.js @@ -62,8 +62,8 @@ const invalidLanguageOptions = [ 7, ]; -for (const invalidLanguageOption of invalidLanguageOptions) { +for (const language of invalidLanguageOptions) { assert.throws(RangeError, function() { - new Intl.Locale("en", {language: invalidLanguageOption}); - }, `${invalidLanguageOption} is an invalid language option value`); + new Intl.Locale("en", {language}); + }, `new Intl.Locale("en", {language: "${language}"}) throws RangeError`); } diff --git a/test/intl402/Locale/constructor-options-language-valid-undefined.js b/test/intl402/Locale/constructor-options-language-valid-undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..08b044abd23610c1804682950f78dc8d4e918670 --- /dev/null +++ b/test/intl402/Locale/constructor-options-language-valid-undefined.js @@ -0,0 +1,40 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl.locale +description: > + Verify valid language option values (undefined) +info: | + Intl.Locale( tag [, options] ) + 10. If options is undefined, then + 11. Else + a. Let options be ? ToObject(options). + 12. Set tag to ? ApplyOptionsToTag(tag, options). + + ApplyOptionsToTag( tag, options ) + ... + 9. If tag matches neither the privateuse nor the grandfathered production, then + b. If language is not undefined, then + i. Set tag to tag with the substring corresponding to the language production replaced by the string language. + +features: [Intl.Locale] +---*/ + +assert.sameValue( + new Intl.Locale('en', {language: undefined}).toString(), + 'en', + `new Intl.Locale('en', {language: undefined}).toString() returns "en"` +); + +assert.sameValue( + new Intl.Locale('en-US', {language: undefined}).toString(), + 'en-US', + `new Intl.Locale('en-US', {language: undefined}).toString() returns "en-US"` +); + +assert.sameValue( + new Intl.Locale('en-els', {language: undefined}).toString(), + 'en-els', + `new Intl.Locale('en-els', {language: undefined}).toString() returns "en-els"` +); diff --git a/test/intl402/Locale/constructor-options-language-valid.js b/test/intl402/Locale/constructor-options-language-valid.js index b07f96619b61e7d716941cec1306b97c1c8f37dd..6b7d405853d2ce926f71ee58decd2ff6be79b631 100644 --- a/test/intl402/Locale/constructor-options-language-valid.js +++ b/test/intl402/Locale/constructor-options-language-valid.js @@ -4,8 +4,7 @@ /*--- esid: sec-intl.locale description: > - Checks error cases for the options argument to the Locale - constructor. + Verify valid language option values (various) info: | Intl.Locale( tag [, options] ) 10. If options is undefined, then @@ -23,38 +22,32 @@ features: [Intl.Locale] ---*/ const validLanguageOptions = [ - [undefined, undefined], [null, 'null'], ['zh-cmn', 'cmn'], ['ZH-CMN', 'cmn'], ['abcd', 'abcd'], - ['abcde', 'abcde'], - ['abcdef', 'abcdef'], - ['abcdefg', 'abcdefg'], - ['abcdefgh', 'abcdefgh'], [{ toString() { return 'de' } }, 'de'], ]; for (const [language, expected] of validLanguageOptions) { - let options = { language }; let expect = expected || 'en'; assert.sameValue( - new Intl.Locale('en', options).toString(), + new Intl.Locale('en', {language}).toString(), expect, - `new Intl.Locale('en', options).toString() equals the value of ${expect}` + `new Intl.Locale('en', {language: "${language}"}).toString() returns "${expect}"` ); expect = (expected || 'en') + '-US'; assert.sameValue( - new Intl.Locale('en-US', options).toString(), + new Intl.Locale('en-US', {language}).toString(), expect, - `new Intl.Locale('en-US', options).toString() equals the value of ${expect}` + `new Intl.Locale('en-US', {language: "${language}"}).toString() returns "${expect}"` ); expect = expected || 'en-els'; assert.sameValue( - new Intl.Locale('en-els', options).toString(), + new Intl.Locale('en-els', {language}).toString(), expect, - `new Intl.Locale('en-els', options).toString() equals the value of ${expect}` + `new Intl.Locale('en-els', {language: "${language}"}).toString() returns "${expect}"` ); } diff --git a/test/intl402/Locale/constructor-options-numberingsystem-invalid.js b/test/intl402/Locale/constructor-options-numberingsystem-invalid.js index 742a9ac483377c3733fa124ddda10c69a8ef9e99..ac0b5c4c8f2322ed1923159be877797c9cfd8d0d 100644 --- a/test/intl402/Locale/constructor-options-numberingsystem-invalid.js +++ b/test/intl402/Locale/constructor-options-numberingsystem-invalid.js @@ -34,8 +34,8 @@ const invalidNumberingSystemOptions = [ "latn-ca-", "latn-ca-gregory", ]; -for (const invalidNumberingSystemOption of invalidNumberingSystemOptions) { +for (const numberingSystem of invalidNumberingSystemOptions) { assert.throws(RangeError, function() { - new Intl.Locale("en", {numberingSystem: invalidNumberingSystemOption}); - }, `${invalidNumberingSystemOption} is an invalid numberingSystem option value`); + new Intl.Locale('en', {numberingSystem}); + }, `new Intl.Locale("en", {numberingSystem: "${numberingSystem}"}) throws RangeError`); } diff --git a/test/intl402/Locale/constructor-options-numberingsystem-valid.js b/test/intl402/Locale/constructor-options-numberingsystem-valid.js index 5ad3716adfc9faa2dd2ed82adfbcb4118791070b..bfd96fc0b9dd1ef4eebb5f60afb759d1e9a3d7b9 100644 --- a/test/intl402/Locale/constructor-options-numberingsystem-valid.js +++ b/test/intl402/Locale/constructor-options-numberingsystem-valid.js @@ -48,15 +48,14 @@ const validNumberingSystemOptions = [ ["1234abcd-abc123", "en-u-nu-1234abcd-abc123"], ]; for (const [numberingSystem, expected] of validNumberingSystemOptions) { - let options = { numberingSystem }; assert.sameValue( - new Intl.Locale('en', options).toString(), + new Intl.Locale('en', { numberingSystem }).toString(), expected, - `new Intl.Locale('en', options).toString() equals the value of ${expected}` + `new Intl.Locale("en", { numberingSystem: ${numberingSystem} }).toString() returns "${expected}"` ); assert.sameValue( - new Intl.Locale('en-u-nu-latn', options).toString(), + new Intl.Locale('en-u-nu-latn', { numberingSystem }).toString(), expected, - `new Intl.Locale('en-u-nu-latn', options).toString() equals the value of ${expected}` + `new Intl.Locale("en-u-nu-latn", { numberingSystem: ${numberingSystem} }).toString() returns "${expected}"` ); } diff --git a/test/intl402/Locale/constructor-options-numeric-undefined.js b/test/intl402/Locale/constructor-options-numeric-undefined.js index fa4251655ca87c51076ee1a69c53493371081130..ee3c787bfab5e6b0aafa9a422fbfcc2b19c2acbf 100644 --- a/test/intl402/Locale/constructor-options-numeric-undefined.js +++ b/test/intl402/Locale/constructor-options-numeric-undefined.js @@ -38,14 +38,17 @@ const options = { numeric: undefined }; assert.sameValue( new Intl.Locale('en', options).toString(), "en", + 'new Intl.Locale("en", {numeric: undefined}).toString() returns "en"' ); assert.sameValue( new Intl.Locale('en-u-kn-true', options).toString(), "en-u-kn-true", + 'new Intl.Locale("en-u-kn-true", {numeric: undefined}).toString() returns "en-u-kn-true"' ); assert.sameValue( new Intl.Locale('en-u-kf-lower', options).numeric, undefined, + 'The value of new Intl.Locale("en-u-kf-lower", {numeric: undefined}).numeric equals `undefined`' ); diff --git a/test/intl402/Locale/constructor-options-numeric-valid.js b/test/intl402/Locale/constructor-options-numeric-valid.js index ce3d1da15a7af8caaaf74a51dd51ac1dc2ceda7e..1f3979d83c56c2f515ddb8505927b5b8bc1c83b8 100644 --- a/test/intl402/Locale/constructor-options-numeric-valid.js +++ b/test/intl402/Locale/constructor-options-numeric-valid.js @@ -46,21 +46,23 @@ const validNumericOptions = [ [{ valueOf() { return false; } }, true], ]; for (const [numeric, expected] of validNumericOptions) { - let options = { numeric }; let expect = `en-u-kn-${expected}`; assert.sameValue( - new Intl.Locale('en', options).toString(), - expect + new Intl.Locale('en', {numeric}).toString(), + expect, + `new Intl.Locale("en", {numeric: ${numeric}}).toString() returns "${expected}"` ); assert.sameValue( - new Intl.Locale('en-u-kn-true', options).toString(), - expect + new Intl.Locale('en-u-kn-true', {numeric}).toString(), + expect, + `new Intl.Locale("en-u-kn-true", {numeric: ${numeric}}).toString() returns "${expected}"` ); assert.sameValue( - new Intl.Locale('en-u-kf-lower', options).numeric, - expected + new Intl.Locale('en-u-kf-lower', {numeric}).numeric, + String(expected), + `new Intl.Locale("en-u-kf-lower", {numeric: ${numeric}}).numeric equals "${expected}"` ); } diff --git a/test/intl402/Locale/constructor-options-region-invalid.js b/test/intl402/Locale/constructor-options-region-invalid.js index 6939c225b98c57f500ff9c210ee584021827d005..dc72485b0b0b660b61ca0966330b239b535dc026 100644 --- a/test/intl402/Locale/constructor-options-region-invalid.js +++ b/test/intl402/Locale/constructor-options-region-invalid.js @@ -49,8 +49,8 @@ const invalidRegionOptions = [ 7, ]; -for (const invalidRegionOption of invalidRegionOptions) { +for (const region of invalidRegionOptions) { assert.throws(RangeError, function() { - new Intl.Locale("en", {region: invalidRegionOption}); - }, `${invalidRegionOption} is an invalid region option value`); + new Intl.Locale("en", {region}); + }, `new Intl.Locale("en", {region: "${region}"}) throws RangeError`); } diff --git a/test/intl402/Locale/constructor-options-region-valid.js b/test/intl402/Locale/constructor-options-region-valid.js index f9cb7eaddf3282ae549fb6d3d500e235ee0dea9f..863d0c81b1472d9fe9a4bd4f7e58c24303081987 100644 --- a/test/intl402/Locale/constructor-options-region-valid.js +++ b/test/intl402/Locale/constructor-options-region-valid.js @@ -41,27 +41,27 @@ for (const [region, expected] of validRegionOptions) { assert.sameValue( new Intl.Locale('en', options).toString(), expect, - `new Intl.Locale('en', options).toString() equals the value of ${expect}` + `new Intl.Locale('en', {region: "${region}"}).toString() returns "${expect}"` ); expect = expected || 'en-US'; assert.sameValue( new Intl.Locale('en-US', options).toString(), expect, - `new Intl.Locale('en-US', options).toString() equals the value of ${expect}` + `new Intl.Locale('en-US', {region: "${region}"}).toString() returns "${expect}"` ); expect = (expected || 'en') + '-u-ca-gregory'; assert.sameValue( new Intl.Locale('en-u-ca-gregory', options).toString(), expect, - `new Intl.Locale('en-u-ca-gregory', options).toString() equals the value of ${expect}` + `new Intl.Locale('en-u-ca-gregory', {region: "${region}"}).toString() returns "${expect}"` ); expect = (expected || 'en-US') + '-u-ca-gregory'; assert.sameValue( new Intl.Locale('en-US-u-ca-gregory', options).toString(), expect, - `new Intl.Locale('en-US-u-ca-gregory', options).toString() equals the value of ${expect}` + `new Intl.Locale('en-US-u-ca-gregory', {region: "${region}"}).toString() returns "${expect}"` ); } diff --git a/test/intl402/Locale/constructor-options-script-invalid.js b/test/intl402/Locale/constructor-options-script-invalid.js index a736280d54824caa43a141c8a39b703cd928c5d6..551cf310179dd81193103f0f240652765ba9a87d 100644 --- a/test/intl402/Locale/constructor-options-script-invalid.js +++ b/test/intl402/Locale/constructor-options-script-invalid.js @@ -45,8 +45,8 @@ const invalidScriptOptions = [ 7, ]; -for (const invalidScriptOption of invalidScriptOptions) { +for (const script of invalidScriptOptions) { assert.throws(RangeError, function() { - new Intl.Locale("en", {script: invalidScriptOption}); - }, `${invalidScriptOption} is an invalid script option value`); + new Intl.Locale("en", {script}); + }, `new Intl.Locale("en", {script: "${script}"}) throws RangeError`); } diff --git a/test/intl402/Locale/constructor-options-script-valid-undefined.js b/test/intl402/Locale/constructor-options-script-valid-undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..6101c1fd15873f23851b2cf3796722ef11347516 --- /dev/null +++ b/test/intl402/Locale/constructor-options-script-valid-undefined.js @@ -0,0 +1,48 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl.locale +description: > + Verify valid script option values (undefined) +info: | + Intl.Locale( tag [, options] ) + 10. If options is undefined, then + 11. Else + a. Let options be ? ToObject(options). + 12. Set tag to ? ApplyOptionsToTag(tag, options). + + ApplyOptionsToTag( tag, options ) + ... + 5. Let script be ? GetOption(options, "script", "string", undefined, undefined). + ... + 9. If tag matches neither the privateuse nor the grandfathered production, then + ... + c. If script is not undefined, then + i. If tag does not contain a script production, then + 1. Set tag to the concatenation of the language production of tag, "-", script, and the rest of tag. + ii. Else, + 1. Set tag to tag with the substring corresponding to the script production replaced by the string script. + + +features: [Intl.Locale] +---*/ + +assert.sameValue( + new Intl.Locale('en', {script: undefined}).toString(), + 'en', + `new Intl.Locale('en', {script: undefined}).toString() returns "en"` +); + +assert.sameValue( + new Intl.Locale('en-DK', {script: undefined}).toString(), + 'en-DK', + `new Intl.Locale('en-DK', {script: undefined}).toString() returns "en-DK"` +); + +assert.sameValue( + new Intl.Locale('en-Cyrl', {script: undefined}).toString(), + 'en-Cyrl', + `new Intl.Locale('en-Cyrl', {script: undefined}).toString() returns "en-Cyrl"` +); + diff --git a/test/intl402/Locale/constructor-options-script-valid.js b/test/intl402/Locale/constructor-options-script-valid.js index 54bd153a6cdb5e4c8cba54d8252b4fe0953a275f..52f033ec2e78544f93e8076445757da3d5346c98 100644 --- a/test/intl402/Locale/constructor-options-script-valid.js +++ b/test/intl402/Locale/constructor-options-script-valid.js @@ -4,10 +4,11 @@ /*--- esid: sec-intl.locale description: > - Checks error cases for the options argument to the Locale - constructor. + Verify valid language option values (various) info: | Intl.Locale( tag [, options] ) + 9. Else, + a. Let tag be ? ToString(tag). 10. If options is undefined, then 11. Else a. Let options be ? ToObject(options). @@ -30,7 +31,6 @@ features: [Intl.Locale] ---*/ const validScriptOptions = [ - [undefined, undefined], [null, 'Null'], ['bali', 'Bali'], ['Bali', 'Bali'], @@ -38,26 +38,25 @@ const validScriptOptions = [ [{ toString() { return 'Brai' } }, 'Brai'], ]; for (const [script, expected] of validScriptOptions) { - let options = { script }; let expect = expected ? 'en-' + expected : 'en'; assert.sameValue( - new Intl.Locale('en', options).toString(), + new Intl.Locale('en', { script }).toString(), expect, - `new Intl.Locale('en', options).toString() equals the value of ${expect}` + `new Intl.Locale("en", {script: "${script}"}).toString() returns "${expect}"` ); expect = (expected ? ('en-' + expected) : 'en') + '-DK'; assert.sameValue( - new Intl.Locale('en-DK', options).toString(), + new Intl.Locale('en-DK', { script }).toString(), expect, - `new Intl.Locale('en', options).toString() equals the value of ${expect}` + `new Intl.Locale("en-DK", {script: "${script}"}).toString() returns "${expect}"` ); expect = expected ? ('en-' + expected) : 'en-Cyrl'; assert.sameValue( - new Intl.Locale('en-Cyrl', options).toString(), + new Intl.Locale('en-Cyrl', { script }).toString(), expect, - `new Intl.Locale('en-Cyrl', options).toString() equals the value of ${expect}` + `new Intl.Locale("en-Cyrl", {script: "${script}"}).toString() returns "${expect}"` ); } diff --git a/test/intl402/Locale/constructor-options-throwing-getters.js b/test/intl402/Locale/constructor-options-throwing-getters.js index d3011011aad54eedfd86c5f146b0b3879d5caabf..f82abd62215a81699bdc8f81376d5921e061a15d 100644 --- a/test/intl402/Locale/constructor-options-throwing-getters.js +++ b/test/intl402/Locale/constructor-options-throwing-getters.js @@ -28,5 +28,6 @@ for (const option of options) { throw new CustomError(); } }); - }, `Exception from ${option} getter should be propagated`); + }, + `new Intl.Locale("en", {get ${option}() {throw new CustomError();}}) throws CustomError`); } diff --git a/test/intl402/Locale/constructor-parse-twice.js b/test/intl402/Locale/constructor-parse-twice.js index 0c9dde16c9bf4328acc91de27e2b3a92c9838698..868bca3047ad613a4ed96cf25f734cbaee340f76 100644 --- a/test/intl402/Locale/constructor-parse-twice.js +++ b/test/intl402/Locale/constructor-parse-twice.js @@ -4,90 +4,93 @@ /*--- esid: sec-intl.locale description: > - Verifies the handling of options with grandfathered tags. + Verifies the handling of options with grandfathered tags. info: | - Intl.Locale( tag [, options] ) - 12. Set tag to ? ApplyOptionsToTag(tag, options). - 14. Let calendar be ? GetOption(options, "calendar", "string", undefined, undefined). - 16. Set opt.[[ca]] to calendar. - 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys). + Intl.Locale( tag [, options] ) + 12. Set tag to ? ApplyOptionsToTag(tag, options). + 14. Let calendar be ? GetOption(options, "calendar", "string", undefined, undefined). + 16. Set opt.[[ca]] to calendar. + 30. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys). - ApplyOptionsToTag( tag, options ) - 9. If tag matches neither the privateuse nor the grandfathered production, then - 10. Return CanonicalizeLanguageTag(tag). + ApplyOptionsToTag( tag, options ) + 9. If tag matches neither the privateuse nor the grandfathered production, then + 10. Return CanonicalizeLanguageTag(tag). features: [Intl.Locale] ---*/ const testData = [ - // Irregular grandfathered tags. + // Irregular grandfathered tags. - // "en-GB-oed" is a grandfathered tag, so we can't add "US". After it is - // canonicalized to "en-GB-oxendict" we can append "u-ca-gregory". - { - tag: "en-GB-oed", - options: { - region: "US", - calendar: "gregory", - }, - canonical: "en-GB-oxendict-u-ca-gregory", + // "en-GB-oed" is a grandfathered tag, so we can't add "US". After it is + // canonicalized to "en-GB-oxendict" we can append "u-ca-gregory". + { + tag: "en-GB-oed", + options: { + region: "US", + calendar: "gregory", }, + canonical: "en-GB-oxendict-u-ca-gregory", + }, - // Canonicalized version of the above, which we can add "US" to. - { - tag: "en-GB-oxendict", - options: { - region: "US", - calendar: "gregory", - }, - canonical: "en-US-oxendict-u-ca-gregory", + // Canonicalized version of the above, which we can add "US" to. + { + tag: "en-GB-oxendict", + options: { + region: "US", + calendar: "gregory", }, + canonical: "en-US-oxendict-u-ca-gregory", + }, - // Regular grandfathered tags. + // Regular grandfathered tags. - // "no-bok" is a grandfathered, so "NO"/"SE" isn't added. After - // canonicalization we can append "u-ca-gregory". - { - tag: "no-bok", - options: { - region: "NO", - calendar: "gregory", - }, - canonical: "nb-u-ca-gregory", + // "no-bok" is a grandfathered, so "NO"/"SE" isn't added. After + // canonicalization we can append "u-ca-gregory". + { + tag: "no-bok", + options: { + region: "NO", + calendar: "gregory", }, + canonical: "nb-u-ca-gregory", + }, - { - tag: "no-bok", - options: { - region: "SE", - calendar: "gregory", - }, - canonical: "nb-u-ca-gregory", + { + tag: "no-bok", + options: { + region: "SE", + calendar: "gregory", }, + canonical: "nb-u-ca-gregory", + }, - // "no-bok-NO" isn't a grandfathered tag, so we can replace "NO" with "SE" - // and can also append "u-ca-gregory". - { - tag: "no-bok-NO", - options: { - region: "SE", - calendar: "gregory", - }, - canonical: "no-bok-SE-u-ca-gregory", + // "no-bok-NO" isn't a grandfathered tag, so we can replace "NO" with "SE" + // and can also append "u-ca-gregory". + { + tag: "no-bok-NO", + options: { + region: "SE", + calendar: "gregory", }, + canonical: "no-bok-SE-u-ca-gregory", + }, - // "no-bok-SE" isn't a grandfathered tag, so we can replace "SE" with "NO" - // and can also append "u-ca-gregory". - { - tag: "no-bok-SE", - options: { - region: "NO", - calendar: "gregory", - }, - canonical: "no-bok-NO-u-ca-gregory", + // "no-bok-SE" isn't a grandfathered tag, so we can replace "SE" with "NO" + // and can also append "u-ca-gregory". + { + tag: "no-bok-SE", + options: { + region: "NO", + calendar: "gregory", }, + canonical: "no-bok-NO-u-ca-gregory", + }, ]; for (const {tag, options, canonical} of testData) { - const loc = new Intl.Locale(tag, options); - assert.sameValue(loc.toString(), canonical); + assert.sameValue( + new Intl.Locale(tag, options).toString(), + canonical, + `new Intl.Locale("${tag}", ${options}).toString() returns "${canonical}"` + ); } diff --git a/test/intl402/Locale/constructor-tag-tostring.js b/test/intl402/Locale/constructor-tag-tostring.js index 733a5cd90dc3a2f82c04d65ace19d90c075cca3e..f1e7ae25d109017bb543455c792a4cd484641dae 100644 --- a/test/intl402/Locale/constructor-tag-tostring.js +++ b/test/intl402/Locale/constructor-tag-tostring.js @@ -31,5 +31,8 @@ const errors = [ ]; for (const input of errors) { - assert.throws(CustomError, function() { new Intl.Locale(input) }); + assert.throws(CustomError, function() { + new Intl.Locale(input); + }), + `new Intl.Locale(${input}) throws CustomError`); } diff --git a/test/intl402/Locale/constructor-tag.js b/test/intl402/Locale/constructor-tag.js index 5deab4d6d9c79fa99a8b9994cd18eaa44f140492..d75ec71d26da994159cb7a5ea688f5e2895804ae 100644 --- a/test/intl402/Locale/constructor-tag.js +++ b/test/intl402/Locale/constructor-tag.js @@ -12,29 +12,34 @@ features: [Intl.Locale] ---*/ const validLanguageTags = { - "eN": "en", - "en-gb": "en-GB", - "IT-LATN-iT": "it-Latn-IT", - "ar-ma-u-ca-islamicc": "ar-MA-u-ca-islamicc", - "th-th-u-nu-thai": "th-TH-u-nu-thai", - "X-u-foo": "x-u-foo", - "en-x-u-foo": "en-x-u-foo", - "en-a-bar-x-u-foo": "en-a-bar-x-u-foo", - "en-x-u-foo-a-bar": "en-x-u-foo-a-bar", - "en-u-baz-a-bar-x-u-foo": "en-a-bar-u-baz-x-u-foo", - "Flob": "flob", - "ZORK": "zork", - "Blah-latn": "blah-Latn", - "QuuX-latn-us": "quux-Latn-US", - "SPAM-gb-x-Sausages-BACON-eggs": "spam-GB-x-sausages-bacon-eggs", - "DE-1996": "de-1996", - "sl-ROZAJ-BISKE-1994": "sl-rozaj-biske-1994", - "zh-latn-pinyin-pinyin2": "zh-Latn-pinyin-pinyin2", + "eN": "en", + "en-gb": "en-GB", + "IT-LATN-iT": "it-Latn-IT", + "th-th-u-nu-thai": "th-TH-u-nu-thai", + "X-u-foo": "x-u-foo", + "en-x-u-foo": "en-x-u-foo", + "en-a-bar-x-u-foo": "en-a-bar-x-u-foo", + "en-x-u-foo-a-bar": "en-x-u-foo-a-bar", + "en-u-baz-a-bar-x-u-foo": "en-a-bar-u-baz-x-u-foo", + "Flob": "flob", + "ZORK": "zork", + "Blah-latn": "blah-Latn", + "QuuX-latn-us": "quux-Latn-US", + "SPAM-gb-x-Sausages-BACON-eggs": "spam-GB-x-sausages-bacon-eggs", + "DE-1996": "de-1996", + "sl-ROZAJ-BISKE-1994": "sl-rozaj-biske-1994", + "zh-latn-pinyin-pinyin2": "zh-Latn-pinyin-pinyin2", }; for (const [langtag, canonical] of Object.entries(validLanguageTags)) { - assert.sameValue(new Intl.Locale(canonical).toString(), canonical, - `"${canonical}" should pass through unchanged`); - assert.sameValue(new Intl.Locale(langtag).toString(), canonical, - `"${langtag}" should be canonicalized to "${canonical}`); + assert.sameValue( + new Intl.Locale(canonical).toString(), + canonical, + `new Intl.Locale("${canonical}").toString() returns "${canonical}"` + ); + assert.sameValue( + new Intl.Locale(langtag).toString(), + canonical, + `new Intl.Locale("${langtag}").toString() returns "${canonical}"` + ); } diff --git a/test/intl402/Locale/constructor-unicode-ext-invalid.js b/test/intl402/Locale/constructor-unicode-ext-invalid.js index 1f1cb08ce96d33bda1fd860848a7f2cda93b6e3d..8129f402299d55722bb2b580ceec40cc2c21d1c9 100644 --- a/test/intl402/Locale/constructor-unicode-ext-invalid.js +++ b/test/intl402/Locale/constructor-unicode-ext-invalid.js @@ -12,19 +12,20 @@ features: [Intl.Locale] ---*/ const invalidLanguageTags = [ - // Unicode extension sequence is incomplete. - "da-u", - "da-u-", - "da-u--", - "da-u-t-latn", - "da-u-x-priv", + // Unicode extension sequence is incomplete. + "da-u", + "da-u-", + "da-u--", + "da-u-t-latn", + "da-u-x-priv", - // Duplicate 'u' singleton. - "da-u-ca-gregory-u-ca-buddhist" + // Duplicate 'u' singleton. + "da-u-ca-gregory-u-ca-buddhist" ]; for (const langtag of invalidLanguageTags) { - assert.throws(RangeError, function() { - new Intl.Locale(langtag) - }); + assert.throws(RangeError, function() { + new Intl.Locale(langtag) + }, + `new Intl.Locale("${langtag}") throws RangeError`); } diff --git a/test/intl402/Locale/constructor-unicode-ext-valid.js b/test/intl402/Locale/constructor-unicode-ext-valid.js index 55ed30cb8cc98535e224c7ae947b4c1bd3692861..d3bebe25d124b34dbb0ea1bc1885312178728490 100644 --- a/test/intl402/Locale/constructor-unicode-ext-valid.js +++ b/test/intl402/Locale/constructor-unicode-ext-valid.js @@ -30,5 +30,9 @@ const validLanguageTags = { }; for (const [langtag, canonical] of Object.entries(validLanguageTags)) { - assert.sameValue(new Intl.Locale(langtag).toString(), canonical); + assert.sameValue( + new Intl.Locale(langtag).toString(), + canonical, + `new Intl.Locale("${langtag}").toString() returns "${canonical}"` + ); } diff --git a/test/intl402/NumberFormat/constructor-default-value.js b/test/intl402/NumberFormat/constructor-default-value.js new file mode 100644 index 0000000000000000000000000000000000000000..0b6d69c9bc88ced31986a7aafe1b8f3ad21c86c7 --- /dev/null +++ b/test/intl402/NumberFormat/constructor-default-value.js @@ -0,0 +1,20 @@ +// Copyright (C) 2018 Ujjwal Sharma. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializenumberformat +description: > + Tests that the constructor for Intl.NumberFormat uses appropriate default + values for its arguments (locales and options). +---*/ + +const actual = new Intl.NumberFormat().resolvedOptions(); +const expected = new Intl.NumberFormat([], { __proto__: null }).resolvedOptions(); + +assert.sameValue(actual.locale, expected.locale); +assert.sameValue(actual.minimumIntegerDigits, expected.minimumIntegerDigits); +assert.sameValue(actual.minimumFractionDigits, expected.minimumFractionDigits); +assert.sameValue(actual.maximumFractionDigits, expected.maximumFractionDigits); +assert.sameValue(actual.numberingSystem, expected.numberingSystem); +assert.sameValue(actual.style, expected.style); +assert.sameValue(actual.useGrouping, expected.useGrouping); diff --git a/test/intl402/NumberFormat/constructor-locales-arraylike.js b/test/intl402/NumberFormat/constructor-locales-arraylike.js new file mode 100644 index 0000000000000000000000000000000000000000..6ed4a3fd2f6a65eba4172dad1eacd858f69eb4ff --- /dev/null +++ b/test/intl402/NumberFormat/constructor-locales-arraylike.js @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Ujjwal Sharma. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializenumberformat +description: > + Tests that the Intl.NumberFormat constructor accepts Array-like values for the + locales argument and treats them well. +---*/ + +const actual = Intl.NumberFormat({ + length: 1, + 1: 'en-US' +}).resolvedOptions(); +const expected = Intl.NumberFormat(['en-US']).resolvedOptions(); + +assert.sameValue(actual.locale, expected.locale); +assert.sameValue(actual.minimumIntegerDigits, expected.minimumIntegerDigits); +assert.sameValue(actual.minimumFractionDigits, expected.minimumFractionDigits); +assert.sameValue(actual.maximumFractionDigits, expected.maximumFractionDigits); +assert.sameValue(actual.numberingSystem, expected.numberingSystem); +assert.sameValue(actual.style, expected.style); +assert.sameValue(actual.useGrouping, expected.useGrouping); diff --git a/test/intl402/NumberFormat/constructor-locales-get-tostring.js b/test/intl402/NumberFormat/constructor-locales-get-tostring.js new file mode 100644 index 0000000000000000000000000000000000000000..a8e3f4898a5fbfd5ecc545ba9e9e641903873dbe --- /dev/null +++ b/test/intl402/NumberFormat/constructor-locales-get-tostring.js @@ -0,0 +1,41 @@ +// Copyright (C) 2018 Ujjwal Sharma. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializenumberformat +description: > + Tests that Get(O, P) and ToString(arg) are properly called within the + constructor for Intl.NumberFormat +info: | + 9.2.1 CanonicalizeLocaleList ( locales ) + + 5. Let len be ? ToLength(? Get(O, "length")). + + 7.a. Let Pk be ToString(k). + + 7.c.i. Let kValue be ? Get(O, Pk). +---*/ + +const locales = { + length: 8, + 1: 'en-US', + 3: 'de-DE', + 5: 'en-IN', + 7: 'en-GB' +}; + +const actualLookups = []; +const expectedLookups = Object.keys(locales); + +const handlers = { + get(obj, prop) { + actualLookups.push(prop); + return Reflect.get(...arguments); + } +}; + +const proxyLocales = new Proxy(locales, handlers); + +const nf = new Intl.NumberFormat(proxyLocales); + +expectedLookups.forEach(lookup => assert(actualLookups.indexOf(lookup) != -1)); diff --git a/test/intl402/NumberFormat/constructor-locales-hasproperty.js b/test/intl402/NumberFormat/constructor-locales-hasproperty.js new file mode 100644 index 0000000000000000000000000000000000000000..e0d0e39464a66fec876d9540edbcd8649620ed08 --- /dev/null +++ b/test/intl402/NumberFormat/constructor-locales-hasproperty.js @@ -0,0 +1,39 @@ +// Copyright (C) 2018 Ujjwal Sharma. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializenumberformat +description: > + Tests that HasProperty(O, Pk) is properly called within the constructor for + Intl.NumberFormat +info: | + 9.2.1 CanonicalizeLocaleList ( locales ) + + 7.b. Let kPresent be ? HasProperty(O, Pk). +---*/ + +const locales = { + length: 8, + 1: 'en-US', + 3: 'de-DE', + 5: 'en-IN', + 7: 'en-GB' +}; + +const actualLookups = []; + +const handlers = { + has(obj, prop) { + actualLookups.push(prop); + return Reflect.has(...arguments); + } +}; + +const proxyLocales = new Proxy(locales, handlers); + +const nf = new Intl.NumberFormat(proxyLocales); + +assert.sameValue(actualLookups.length, locales.length); +for (let index in actualLookups) { + assert.sameValue(actualLookups[index], String(index)); +} diff --git a/test/intl402/NumberFormat/constructor-locales-string.js b/test/intl402/NumberFormat/constructor-locales-string.js new file mode 100644 index 0000000000000000000000000000000000000000..b0baa3a0843f0955d980a7c5671d190a34c0847a --- /dev/null +++ b/test/intl402/NumberFormat/constructor-locales-string.js @@ -0,0 +1,25 @@ +// Copyright (C) 2018 Ujjwal Sharma. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializenumberformat +description: > + Tests that passing a string value to the Intl.NumberFormat constructor is + equivalent to passing an Array containing the same string value. +info: | + 9.2.1 CanonicalizeLocaleList ( locales ) + + 3 .If Type(locales) is String, then + a. Let O be CreateArrayFromList(« locales »). +---*/ + +const actual = Intl.NumberFormat('en-US').resolvedOptions(); +const expected = Intl.NumberFormat(['en-US']).resolvedOptions(); + +assert.sameValue(actual.locale, expected.locale); +assert.sameValue(actual.minimumIntegerDigits, expected.minimumIntegerDigits); +assert.sameValue(actual.minimumFractionDigits, expected.minimumFractionDigits); +assert.sameValue(actual.maximumFractionDigits, expected.maximumFractionDigits); +assert.sameValue(actual.numberingSystem, expected.numberingSystem); +assert.sameValue(actual.style, expected.style); +assert.sameValue(actual.useGrouping, expected.useGrouping); diff --git a/test/intl402/NumberFormat/constructor-locales-toobject.js b/test/intl402/NumberFormat/constructor-locales-toobject.js new file mode 100644 index 0000000000000000000000000000000000000000..3d2625191bee83ed995d9e5604f1cf88ac41f951 --- /dev/null +++ b/test/intl402/NumberFormat/constructor-locales-toobject.js @@ -0,0 +1,39 @@ +// Copyright (C) 2018 Ujjwal Sharma. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializenumberformat +description: > + Tests that Intl.NumberFormat contructor converts the locales argument + to an object using `ToObject` (7.1.13). +info: | + 9.2.1 CanonicalizeLocaleList + + 4.a. Let O be ? ToObject(locales). +---*/ + +const toObjectResults = [ + [true, new Boolean(true)], + [42, new Number(42)], + [{}, {}], + [Symbol(), Object(Symbol())] +]; + +// Test if ToObject is used to convert primitives to Objects. +toObjectResults.forEach(pair => { + const [value, result] = pair; + const actual = new Intl.NumberFormat(value).resolvedOptions(); + const expected = new Intl.NumberFormat(result).resolvedOptions() + + assert.sameValue(actual.locale, expected.locale); + assert.sameValue(actual.minimumIntegerDigits, expected.minimumIntegerDigits); + assert.sameValue(actual.minimumFractionDigits, expected.minimumFractionDigits); + assert.sameValue(actual.maximumFractionDigits, expected.maximumFractionDigits); + assert.sameValue(actual.numberingSystem, expected.numberingSystem); + assert.sameValue(actual.style, expected.style); + assert.sameValue(actual.useGrouping, expected.useGrouping); +}); + +// ToObject throws a TypeError for undefined and null, but it's not called +// when locales is undefined. +assert.throws(TypeError, () => new Intl.NumberFormat(null)); diff --git a/test/intl402/NumberFormat/constructor-options-toobject.js b/test/intl402/NumberFormat/constructor-options-toobject.js new file mode 100644 index 0000000000000000000000000000000000000000..43f5d10edf1bbbb1a2dd4091586957aba05cb095 --- /dev/null +++ b/test/intl402/NumberFormat/constructor-options-toobject.js @@ -0,0 +1,40 @@ +// Copyright (C) 2018 Ujjwal Sharma. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializenumberformat +description: > + Tests that Intl.NumberFormat contructor converts the options argument + to an object using `ToObject` (7.1.13). +info: | + 11.1.2 InitializeNumberFormat + + 3.a. Let options be ? ToObject(options). +---*/ + +const toObjectResults = [ + [true, new Boolean(true)], + [42, new Number(42)], + ['foo', new String('foo')], + [{}, {}], + [Symbol(), Object(Symbol())] +]; + +// Test if ToObject is used to convert primitives to Objects. +toObjectResults.forEach(pair => { + const [value, result] = pair; + const actual = new Intl.NumberFormat(['en-US'], value).resolvedOptions(); + const expected = new Intl.NumberFormat(['en-US'], result).resolvedOptions(); + assert.sameValue(actual.locale, expected.locale); + assert.sameValue(actual.minimumIntegerDigits, expected.minimumIntegerDigits); + assert.sameValue(actual.minimumFractionDigits, expected.minimumFractionDigits); + assert.sameValue(actual.maximumFractionDigits, expected.maximumFractionDigits); + assert.sameValue(actual.numberingSystem, expected.numberingSystem); + assert.sameValue(actual.style, expected.style); + assert.sameValue(actual.useGrouping, expected.useGrouping); + +}); + +// ToObject throws a TypeError for undefined and null, but it's not called +// when options is undefined. +assert.throws(TypeError, () => new Intl.NumberFormat(['en-US'], null)); diff --git a/test/intl402/NumberFormat/ignore-invalid-unicode-ext-values.js b/test/intl402/NumberFormat/ignore-invalid-unicode-ext-values.js index 0a305d052a2ccb2923315a9f60d12121b4fd9700..8a0c01b4588502a72ae20d26d445972f303dc78c 100644 --- a/test/intl402/NumberFormat/ignore-invalid-unicode-ext-values.js +++ b/test/intl402/NumberFormat/ignore-invalid-unicode-ext-values.js @@ -21,7 +21,7 @@ locales.forEach(function (locale) { var keyValues = { "cu": ["USD", "EUR", "JPY", "CNY", "TWD", "invalid"], - "nu": ["native", "traditio", "finance", "invalid"] + "nu": ["native", "traditio", "finance"] }; Object.getOwnPropertyNames(keyValues).forEach(function (key) { diff --git a/test/language/expressions/async-arrow-function/dflt-params-abrupt.js b/test/language/expressions/async-arrow-function/dflt-params-abrupt.js index 4a92b9d3654706faf79b2d75eeaf4ab67e864b1b..2bab8286f8bed6db0e100f95f786204537ccedae 100644 --- a/test/language/expressions/async-arrow-function/dflt-params-abrupt.js +++ b/test/language/expressions/async-arrow-function/dflt-params-abrupt.js @@ -4,7 +4,7 @@ /*--- description: Abrupt completion returned by evaluation of initializer (async arrow function expression) esid: sec-async-arrow-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.7 Async Arrow Function Definitions diff --git a/test/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js b/test/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js index 592e75e2ba43da8e96aa5ace985aad31b7869376..80e3b5fbbe8944f27cfca14beaa7d7ced01b808a 100644 --- a/test/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js +++ b/test/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is not `undefined` (async arrow function expression) esid: sec-async-arrow-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.7 Async Arrow Function Definitions diff --git a/test/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js b/test/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js index f434b961dd6d1039ffb974e4a4385682fefdd4ff..4d47665d340c9aba8b0335ed93763ab5af0f625a 100644 --- a/test/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js +++ b/test/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is `undefined` (async arrow function expression) esid: sec-async-arrow-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.7 Async Arrow Function Definitions diff --git a/test/language/expressions/async-arrow-function/dflt-params-ref-later.js b/test/language/expressions/async-arrow-function/dflt-params-ref-later.js index b1f1c9fca379b5b8af4f58c8f504ffc8e1985968..2ec8e074a8ba4b86c4994a9d7acd4d458f535df0 100644 --- a/test/language/expressions/async-arrow-function/dflt-params-ref-later.js +++ b/test/language/expressions/async-arrow-function/dflt-params-ref-later.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs later in the ParameterList (async arrow function expression) esid: sec-async-arrow-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.7 Async Arrow Function Definitions diff --git a/test/language/expressions/async-arrow-function/dflt-params-ref-prior.js b/test/language/expressions/async-arrow-function/dflt-params-ref-prior.js index 6225f7633d88f0a02f36d6a18f851dac018487cc..c775b76de0e0d70452106c23db1f5364a9d3d4ab 100644 --- a/test/language/expressions/async-arrow-function/dflt-params-ref-prior.js +++ b/test/language/expressions/async-arrow-function/dflt-params-ref-prior.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs earlier in the ParameterList (async arrow function expression) esid: sec-async-arrow-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.7 Async Arrow Function Definitions diff --git a/test/language/expressions/async-arrow-function/dflt-params-ref-self.js b/test/language/expressions/async-arrow-function/dflt-params-ref-self.js index b2c3a2ec0e62726d4114f083d911cdbdb7f125ab..cd9edcfbd2957a1108ac5507aac4432ac17290f6 100644 --- a/test/language/expressions/async-arrow-function/dflt-params-ref-self.js +++ b/test/language/expressions/async-arrow-function/dflt-params-ref-self.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter from within its own initializer (async arrow function expression) esid: sec-async-arrow-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.7 Async Arrow Function Definitions diff --git a/test/language/expressions/async-arrow-function/dflt-params-trailing-comma.js b/test/language/expressions/async-arrow-function/dflt-params-trailing-comma.js index c573b2003b21f919a869b107f0820b391d0d1cdb..6dec5de65e3f489ac5ce720a2ce6876288fcdc6e 100644 --- a/test/language/expressions/async-arrow-function/dflt-params-trailing-comma.js +++ b/test/language/expressions/async-arrow-function/dflt-params-trailing-comma.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using default parameters (async arrow function expression) esid: sec-async-arrow-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.7 Async Arrow Function Definitions diff --git a/test/language/expressions/async-arrow-function/params-trailing-comma-multiple.js b/test/language/expressions/async-arrow-function/params-trailing-comma-multiple.js index 71c1803d29fdcd94410a07c421fba8f0c036aaef..ca0e8995b1f8c1ed3ad208f401d7b30b30e716d7 100644 --- a/test/language/expressions/async-arrow-function/params-trailing-comma-multiple.js +++ b/test/language/expressions/async-arrow-function/params-trailing-comma-multiple.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using multiple parameters (async arrow function expression) esid: sec-async-arrow-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.7 Async Arrow Function Definitions diff --git a/test/language/expressions/async-arrow-function/params-trailing-comma-single.js b/test/language/expressions/async-arrow-function/params-trailing-comma-single.js index 47612e2807f1bb898010482a128824877d883a12..252c975e4fcc7e3f52b0a4463693c6c05c143130 100644 --- a/test/language/expressions/async-arrow-function/params-trailing-comma-single.js +++ b/test/language/expressions/async-arrow-function/params-trailing-comma-single.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using a single parameter (async arrow function expression) esid: sec-async-arrow-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.7 Async Arrow Function Definitions diff --git a/test/language/expressions/async-function/named-dflt-params-abrupt.js b/test/language/expressions/async-function/named-dflt-params-abrupt.js index 59bf344175fdf109c6b27f22b392bf6fd92172f0..7806944c8b6b7a469a5ac776b196a7145a23750f 100644 --- a/test/language/expressions/async-function/named-dflt-params-abrupt.js +++ b/test/language/expressions/async-function/named-dflt-params-abrupt.js @@ -4,7 +4,7 @@ /*--- description: Abrupt completion returned by evaluation of initializer (async function named expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js b/test/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js index c470f3bb582bf2dc64faeb03b9ac86a6ae76adfd..18f41866b6d1694485810e38c08ce8324d87ba49 100644 --- a/test/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js +++ b/test/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is not `undefined` (async function named expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/named-dflt-params-arg-val-undefined.js b/test/language/expressions/async-function/named-dflt-params-arg-val-undefined.js index 7bd0e00ffcf1f22b67d9bad3982133b406d37cfd..eaaddf542d31d2d4d058daa3980f5ec89e5695cb 100644 --- a/test/language/expressions/async-function/named-dflt-params-arg-val-undefined.js +++ b/test/language/expressions/async-function/named-dflt-params-arg-val-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is `undefined` (async function named expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/named-dflt-params-duplicates.js b/test/language/expressions/async-function/named-dflt-params-duplicates.js index 90493df31427e901d410615eb435e5b44ca5414f..3a7d31fd7d6a62a28604ea4783fbfca0cf53effe 100644 --- a/test/language/expressions/async-function/named-dflt-params-duplicates.js +++ b/test/language/expressions/async-function/named-dflt-params-duplicates.js @@ -4,7 +4,7 @@ /*--- description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async function named expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated] negative: phase: parse diff --git a/test/language/expressions/async-function/named-dflt-params-ref-later.js b/test/language/expressions/async-function/named-dflt-params-ref-later.js index df85f734fbc4010bac0a357e0ab6d1567c192274..35c4d2889b80e35e34ff960e3bc2f38cd208ae5d 100644 --- a/test/language/expressions/async-function/named-dflt-params-ref-later.js +++ b/test/language/expressions/async-function/named-dflt-params-ref-later.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs later in the ParameterList (async function named expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/named-dflt-params-ref-prior.js b/test/language/expressions/async-function/named-dflt-params-ref-prior.js index e58f833f95658ebe8d69ffd93441cd0b9679e117..4eddaec0f2b550334cfe79debf9df4a89b81eb55 100644 --- a/test/language/expressions/async-function/named-dflt-params-ref-prior.js +++ b/test/language/expressions/async-function/named-dflt-params-ref-prior.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs earlier in the ParameterList (async function named expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/named-dflt-params-ref-self.js b/test/language/expressions/async-function/named-dflt-params-ref-self.js index 3b2141252f532032bb88adb6254049ed139cc844..d35724b6c0172beae41ab24c9b1b49c51f2be3f6 100644 --- a/test/language/expressions/async-function/named-dflt-params-ref-self.js +++ b/test/language/expressions/async-function/named-dflt-params-ref-self.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter from within its own initializer (async function named expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/named-dflt-params-rest.js b/test/language/expressions/async-function/named-dflt-params-rest.js index 90625c390a7057d0bb28a4f765136d958a6ba3d2..4884d9b3f0f4498b9908df32cf1bccea39954258 100644 --- a/test/language/expressions/async-function/named-dflt-params-rest.js +++ b/test/language/expressions/async-function/named-dflt-params-rest.js @@ -4,7 +4,7 @@ /*--- description: RestParameter does not support an initializer (async function named expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated] negative: phase: parse diff --git a/test/language/expressions/async-function/named-dflt-params-trailing-comma.js b/test/language/expressions/async-function/named-dflt-params-trailing-comma.js index b85f48d055c7496fe5a77701e1ce26b7cda8618e..1f9a392685b8329f42b1689711fb81fe002e32f6 100644 --- a/test/language/expressions/async-function/named-dflt-params-trailing-comma.js +++ b/test/language/expressions/async-function/named-dflt-params-trailing-comma.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using default parameters (async function named expression) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/named-params-trailing-comma-multiple.js b/test/language/expressions/async-function/named-params-trailing-comma-multiple.js index d75b5340f64752c770d5b874f9ea3a85735e261a..bfc5c5b96abf851b387f0c77a495bf38e3db867e 100644 --- a/test/language/expressions/async-function/named-params-trailing-comma-multiple.js +++ b/test/language/expressions/async-function/named-params-trailing-comma-multiple.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using multiple parameters (async function named expression) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/named-params-trailing-comma-single.js b/test/language/expressions/async-function/named-params-trailing-comma-single.js index b1e4a4745f7724c02f818cec97f490586c4b99ab..0f53f040c78f557d901e697ed8a1cbac94190e06 100644 --- a/test/language/expressions/async-function/named-params-trailing-comma-single.js +++ b/test/language/expressions/async-function/named-params-trailing-comma-single.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using a single parameter (async function named expression) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js b/test/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js index a9b81f954cac18ade0eea095c9952fc0b0093a67..87d3ebe6c5750dc51cdb3d111aee4dfd0ac28562 100644 --- a/test/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js +++ b/test/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js @@ -4,6 +4,7 @@ /*--- description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async function named expression) esid: sec-async-function-definitions +features: [async-functions] flags: [generated] negative: phase: parse diff --git a/test/language/expressions/async-function/nameless-dflt-params-abrupt.js b/test/language/expressions/async-function/nameless-dflt-params-abrupt.js index 6ce5cda340147e1d88c89b1f620cc9bbb50421ff..ccdbd064c0a4db4b407a1be500f5435ca71a0291 100644 --- a/test/language/expressions/async-function/nameless-dflt-params-abrupt.js +++ b/test/language/expressions/async-function/nameless-dflt-params-abrupt.js @@ -4,7 +4,7 @@ /*--- description: Abrupt completion returned by evaluation of initializer (async function nameless expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js b/test/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js index 86c05584d35a4703c4c5383bc8ca89a4df255b09..3bd6462accf703e7fbc45eae7a323388d8bbb702 100644 --- a/test/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js +++ b/test/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is not `undefined` (async function nameless expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js b/test/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js index de8d232fba1e33f45018aaef9099017ffbc6bd82..22f86933798819f22c808318a87d1d537223f5dc 100644 --- a/test/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js +++ b/test/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is `undefined` (async function nameless expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/nameless-dflt-params-duplicates.js b/test/language/expressions/async-function/nameless-dflt-params-duplicates.js index 57cf5b55df3cf048b56b1d1df5f1670a3b6c8b05..cf0a4919591dd765e2becdbab43104c9a686a8e8 100644 --- a/test/language/expressions/async-function/nameless-dflt-params-duplicates.js +++ b/test/language/expressions/async-function/nameless-dflt-params-duplicates.js @@ -4,7 +4,7 @@ /*--- description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async function nameless expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated] negative: phase: parse @@ -15,6 +15,7 @@ info: | AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + 14.1.2 Static Semantics: Early Errors StrictFormalParameters : FormalParameters diff --git a/test/language/expressions/async-function/nameless-dflt-params-ref-later.js b/test/language/expressions/async-function/nameless-dflt-params-ref-later.js index c0da90a866e2d5039d04256789cc6d704f694f56..d2e8d6de0b67f493e1598b76c17e2512b07d8b53 100644 --- a/test/language/expressions/async-function/nameless-dflt-params-ref-later.js +++ b/test/language/expressions/async-function/nameless-dflt-params-ref-later.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs later in the ParameterList (async function nameless expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/nameless-dflt-params-ref-prior.js b/test/language/expressions/async-function/nameless-dflt-params-ref-prior.js index 42e1111132c7f0f954baccabad14e5674079506a..df5d363ea702816369c682cc582093579083875e 100644 --- a/test/language/expressions/async-function/nameless-dflt-params-ref-prior.js +++ b/test/language/expressions/async-function/nameless-dflt-params-ref-prior.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs earlier in the ParameterList (async function nameless expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/nameless-dflt-params-ref-self.js b/test/language/expressions/async-function/nameless-dflt-params-ref-self.js index a98a3afd6e7bacf1f880b599a61e5690213a0f75..eb2faa591bb013332f50f8415890573e20cec385 100644 --- a/test/language/expressions/async-function/nameless-dflt-params-ref-self.js +++ b/test/language/expressions/async-function/nameless-dflt-params-ref-self.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter from within its own initializer (async function nameless expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/nameless-dflt-params-rest.js b/test/language/expressions/async-function/nameless-dflt-params-rest.js index 573c8c2df420b72126e5ea60f256fade149e4981..9d34dce10bcc835ab28efe9df8683bfa38c40651 100644 --- a/test/language/expressions/async-function/nameless-dflt-params-rest.js +++ b/test/language/expressions/async-function/nameless-dflt-params-rest.js @@ -4,7 +4,7 @@ /*--- description: RestParameter does not support an initializer (async function nameless expression) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated] negative: phase: parse @@ -15,6 +15,7 @@ info: | AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + 14.1 Function Definitions Syntax diff --git a/test/language/expressions/async-function/nameless-dflt-params-trailing-comma.js b/test/language/expressions/async-function/nameless-dflt-params-trailing-comma.js index f19210db6c95f9a25203a4cdc33a380584104a6f..62bdf7864fe8951b3bb7e44bb1d5f6f4e8ad12aa 100644 --- a/test/language/expressions/async-function/nameless-dflt-params-trailing-comma.js +++ b/test/language/expressions/async-function/nameless-dflt-params-trailing-comma.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using default parameters (async function nameless expression) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/nameless-params-trailing-comma-multiple.js b/test/language/expressions/async-function/nameless-params-trailing-comma-multiple.js index 48e741e2590821856e569e4e5d17434fe4056c51..b56a5e5f42db9097d287f03b9a9a0572ff66c5f2 100644 --- a/test/language/expressions/async-function/nameless-params-trailing-comma-multiple.js +++ b/test/language/expressions/async-function/nameless-params-trailing-comma-multiple.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using multiple parameters (async function nameless expression) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/nameless-params-trailing-comma-single.js b/test/language/expressions/async-function/nameless-params-trailing-comma-single.js index 07def87fd782acd2fd2b57b3c81c0da76481ad02..c5c142de3555f40aebedcf7da1ad84fcd372d09f 100644 --- a/test/language/expressions/async-function/nameless-params-trailing-comma-single.js +++ b/test/language/expressions/async-function/nameless-params-trailing-comma-single.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using a single parameter (async function nameless expression) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js b/test/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js index f765b7c16eccdd03e141e904117905c24880c171..7d41cc239d8996173a862f258321d982404a52b7 100644 --- a/test/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js +++ b/test/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js @@ -4,6 +4,7 @@ /*--- description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async function nameless expression) esid: sec-async-function-definitions +features: [async-functions] flags: [generated] negative: phase: parse @@ -14,6 +15,7 @@ info: | AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + Trailing comma in the parameters list 14.1 Function Definitions diff --git a/test/language/expressions/class/async-meth-dflt-params-abrupt.js b/test/language/expressions/class/async-meth-dflt-params-abrupt.js index 3d022ae7eb269148b5bdf7d5cd1f33f9053570f2..b8d653bc7c276c5d510b104ccaf79e6db1570f51 100644 --- a/test/language/expressions/class/async-meth-dflt-params-abrupt.js +++ b/test/language/expressions/class/async-meth-dflt-params-abrupt.js @@ -4,7 +4,7 @@ /*--- description: Abrupt completion returned by evaluation of initializer (class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-dflt-params-arg-val-not-undefined.js b/test/language/expressions/class/async-meth-dflt-params-arg-val-not-undefined.js index 4e0ea6d1d3af2b345c2e9b8f1586cdbe5d7747c3..ef06a20b6b76f0c7339b931e5340e4a7b3e1d4b7 100644 --- a/test/language/expressions/class/async-meth-dflt-params-arg-val-not-undefined.js +++ b/test/language/expressions/class/async-meth-dflt-params-arg-val-not-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is not `undefined` (class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-dflt-params-arg-val-undefined.js b/test/language/expressions/class/async-meth-dflt-params-arg-val-undefined.js index 38f561f97c5d55ab1e8d3660c5a7ca8fc5519fb7..53cf0ba589afa4e79fb14989ad21cb28d779f63d 100644 --- a/test/language/expressions/class/async-meth-dflt-params-arg-val-undefined.js +++ b/test/language/expressions/class/async-meth-dflt-params-arg-val-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is `undefined` (class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-dflt-params-ref-later.js b/test/language/expressions/class/async-meth-dflt-params-ref-later.js index d0e8d3885b28bdc8d7421d5f6b3bc7890cfb63ef..3c855a820aa80dcb2d3ca17331b54af4c14c3312 100644 --- a/test/language/expressions/class/async-meth-dflt-params-ref-later.js +++ b/test/language/expressions/class/async-meth-dflt-params-ref-later.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs later in the ParameterList (class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-dflt-params-ref-prior.js b/test/language/expressions/class/async-meth-dflt-params-ref-prior.js index bc3daf029ea69c88968b8b5050b01db2c23de295..52a1a6132ed74ddbb533f2f4860afab474206bdb 100644 --- a/test/language/expressions/class/async-meth-dflt-params-ref-prior.js +++ b/test/language/expressions/class/async-meth-dflt-params-ref-prior.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs earlier in the ParameterList (class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-dflt-params-ref-self.js b/test/language/expressions/class/async-meth-dflt-params-ref-self.js index 7610efb1c40d9029fb26bda39337dcc1f77032f3..051a046811ba4685db2dd3d903a9ee0a15b7b93f 100644 --- a/test/language/expressions/class/async-meth-dflt-params-ref-self.js +++ b/test/language/expressions/class/async-meth-dflt-params-ref-self.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter from within its own initializer (class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-dflt-params-trailing-comma.js b/test/language/expressions/class/async-meth-dflt-params-trailing-comma.js index 1b2564966255b4604b63aa93ca14b8dd43c2fed7..bcabd89448a27381e886cdce473382bfaccf353d 100644 --- a/test/language/expressions/class/async-meth-dflt-params-trailing-comma.js +++ b/test/language/expressions/class/async-meth-dflt-params-trailing-comma.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using default parameters (class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-params-trailing-comma-multiple.js b/test/language/expressions/class/async-meth-params-trailing-comma-multiple.js index 12f3375a8d5bf6744219b7311bf86412de7faf74..9ae58bb905cb0fa49ff49d338d9f4751f3a43af9 100644 --- a/test/language/expressions/class/async-meth-params-trailing-comma-multiple.js +++ b/test/language/expressions/class/async-meth-params-trailing-comma-multiple.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using multiple parameters (class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-params-trailing-comma-single.js b/test/language/expressions/class/async-meth-params-trailing-comma-single.js index b3db8e16e918a4b4b01628cd9b32d0e1281a1075..e5be368535bcc0c240a161b91ce1864c9337684d 100644 --- a/test/language/expressions/class/async-meth-params-trailing-comma-single.js +++ b/test/language/expressions/class/async-meth-params-trailing-comma-single.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using a single parameter (class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-static-dflt-params-abrupt.js b/test/language/expressions/class/async-meth-static-dflt-params-abrupt.js index 3bdd1a3c90dbd097b636b178c03db1e93fd606a3..8a5cfd60b801e5ffb86f246454c8776df944ff4b 100644 --- a/test/language/expressions/class/async-meth-static-dflt-params-abrupt.js +++ b/test/language/expressions/class/async-meth-static-dflt-params-abrupt.js @@ -4,7 +4,7 @@ /*--- description: Abrupt completion returned by evaluation of initializer (static class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-static-dflt-params-arg-val-not-undefined.js b/test/language/expressions/class/async-meth-static-dflt-params-arg-val-not-undefined.js index 2e71262360c3279b513449a3c56eb1ea6c6d60ed..9aad97c6211edfa0c3530c17d4ca912dac347575 100644 --- a/test/language/expressions/class/async-meth-static-dflt-params-arg-val-not-undefined.js +++ b/test/language/expressions/class/async-meth-static-dflt-params-arg-val-not-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is not `undefined` (static class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-static-dflt-params-arg-val-undefined.js b/test/language/expressions/class/async-meth-static-dflt-params-arg-val-undefined.js index 48c3814948e96a9b583f6e065dece8c3e9376ab0..1db91b58f8b00ce75fdae412d8e55c8247d5080e 100644 --- a/test/language/expressions/class/async-meth-static-dflt-params-arg-val-undefined.js +++ b/test/language/expressions/class/async-meth-static-dflt-params-arg-val-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is `undefined` (static class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-static-dflt-params-ref-later.js b/test/language/expressions/class/async-meth-static-dflt-params-ref-later.js index 321f7ac4c7485a9f2787aa7785ba5f7e5d354dbc..9f121948d4cbb467284872c5f7179f8cf7fba565 100644 --- a/test/language/expressions/class/async-meth-static-dflt-params-ref-later.js +++ b/test/language/expressions/class/async-meth-static-dflt-params-ref-later.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs later in the ParameterList (static class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-static-dflt-params-ref-prior.js b/test/language/expressions/class/async-meth-static-dflt-params-ref-prior.js index 903438149e61ab578ff597c30a47b523938f7eed..772775ea8779a3a35312b804d268d739de9a5045 100644 --- a/test/language/expressions/class/async-meth-static-dflt-params-ref-prior.js +++ b/test/language/expressions/class/async-meth-static-dflt-params-ref-prior.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs earlier in the ParameterList (static class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-static-dflt-params-ref-self.js b/test/language/expressions/class/async-meth-static-dflt-params-ref-self.js index e7b3af1f59e4ad59b588a910b93dc5514f6d17a7..52fc0b4956d5bd2c8077c28ea7e5fa7c7fbfd80c 100644 --- a/test/language/expressions/class/async-meth-static-dflt-params-ref-self.js +++ b/test/language/expressions/class/async-meth-static-dflt-params-ref-self.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter from within its own initializer (static class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-static-dflt-params-trailing-comma.js b/test/language/expressions/class/async-meth-static-dflt-params-trailing-comma.js index 9afa64ed456f0abcbd5b80653cc0a651c73134b2..e0d671ead8ac516efe9f4ee19c3ea5f305d9af46 100644 --- a/test/language/expressions/class/async-meth-static-dflt-params-trailing-comma.js +++ b/test/language/expressions/class/async-meth-static-dflt-params-trailing-comma.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using default parameters (static class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-static-params-trailing-comma-multiple.js b/test/language/expressions/class/async-meth-static-params-trailing-comma-multiple.js index 172b92ce92689a699edf131f833b65b323fc65f6..f4ce988d8f0e16c5cbd55c1db7a7a458c4262458 100644 --- a/test/language/expressions/class/async-meth-static-params-trailing-comma-multiple.js +++ b/test/language/expressions/class/async-meth-static-params-trailing-comma-multiple.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using multiple parameters (static class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/async-meth-static-params-trailing-comma-single.js b/test/language/expressions/class/async-meth-static-params-trailing-comma-single.js index 8177a8e1fce0f5bc002dac50c46092ebeb5e64f1..c7778d89cd1881ed250b492cd9aaa22fe49d7a31 100644 --- a/test/language/expressions/class/async-meth-static-params-trailing-comma-single.js +++ b/test/language/expressions/class/async-meth-static-params-trailing-comma-single.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using a single parameter (static class expression async method) esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] flags: [generated, async] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-close.js b/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-close.js index b79ef306a0d316c68b1a87a6c48c68ea4cbe7c3e..e164583a3573595444f667ab06f1db9ec6598363 100644 --- a/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-close.js +++ b/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-close.js @@ -4,8 +4,7 @@ /*--- description: Iterator is closed when not exhausted by pattern evaluation (private class expression method (default parameter)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close.js b/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close.js index 594deb498e06405c856f9fea7eccfb052174441e..7268c5a7f526734a2210004504aa914ca9ecf2c4 100644 --- a/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close.js +++ b/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close.js @@ -4,8 +4,7 @@ /*--- description: Iterator is not closed when exhausted by pattern evaluation (private class expression method (default parameter)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js index 6f9d332db026f53dcce3e1d264777fc4e445dec4..4e1654fb3beb1e704f3868c8dab547c1f10e546f 100644 --- a/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js +++ b/test/language/expressions/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -4,8 +4,7 @@ /*--- description: RestElement applied to an exhausted iterator (private class expression method (default parameter)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close.js b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close.js index 87314df2bd271bf0d7f66ec9399fe3f8fde19f0c..c269feda1f5f7b0463a57efe964a30d62617bc93 100644 --- a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close.js +++ b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close.js @@ -4,8 +4,7 @@ /*--- description: Iterator is closed when not exhausted by pattern evaluation (private static class expression generator method (default parameter)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close.js b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close.js index c9b1ab72c52edfd5426cbf5757a57148ecf7402a..971dd3a06238dc19a2f1a918c66307ab91fb4a90 100644 --- a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close.js +++ b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close.js @@ -4,8 +4,7 @@ /*--- description: Iterator is not closed when exhausted by pattern evaluation (private static class expression generator method (default parameter)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js index 84946ebc63341a235664b52b2545db998f86073f..41d4241067f05a5b990eb5446e27631c9920cbe8 100644 --- a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js +++ b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js @@ -4,8 +4,7 @@ /*--- description: RestElement applied to an exhausted iterator (private static class expression generator method (default parameter)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassExpression : class BindingIdentifieropt ClassTail diff --git a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js index ef571cbc0c172f5653d746ad6a7c269616d6af41..795afcd4b7dc090d74fefbf7b66b36e9136a6ced 100644 --- a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js +++ b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js @@ -4,8 +4,7 @@ /*--- description: Getter is called when obj is being deconstructed to a rest Object (private static class expression generator method (default parameter)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js index dd8ad9be4b4d7f6c1077fffdef3357e482f748ed..fa40c62422ca58244b0d27849381e30ed1855e6c 100644 --- a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js +++ b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -4,8 +4,7 @@ /*--- description: Rest object doesn't contain non-enumerable properties (private static class expression generator method (default parameter)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js index 99277b45b4127592a1cf9dea67a3e102b252412f..cf04095bc17dcd3d5a252c95d76c3240b3f9e526 100644 --- a/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js +++ b/test/language/expressions/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js @@ -4,8 +4,7 @@ /*--- description: Rest object contains just unextracted data (private static class expression generator method (default parameter)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js index b0c9b53014567c39a298714d5083708f5a41cf38..1e2ea2a3f98aad85ef34f4183d80300e364c12c7 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions after a static async generator in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - async-iteration] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-iteration] flags: [generated, async] includes: [propertyHelper.js] info: | diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js b/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js index 7713267aa6c062db6dd1b0019c870341944a84d7..c1cabff6210d6f6cbf03539f8d112bf3c374c42f 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions after a static async method in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - async-functions] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-functions] flags: [generated, async] includes: [propertyHelper.js] info: | diff --git a/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods-with-fields.js index 51ccec54c2a75ecabf0aa0689198f47b2f65a1d4..23e38b34d58eb03086b0f09ef3ef3751527a917d 100644 --- a/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods-with-fields.js +++ b/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions followed by a method in a new line with a semicolon) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - generators] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, generators] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/expressions/class/fields-same-line-async-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-same-line-async-gen-static-private-methods-with-fields.js index 0942691d19a0fa625f13e3935309e57ab82dfa24..7396da2ac22443d93c563e6a88fd50b84b062199 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-static-private-methods-with-fields.js +++ b/test/language/expressions/class/fields-same-line-async-gen-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions after an async generator in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - async-iteration] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-iteration] flags: [generated, async] includes: [propertyHelper.js] info: | diff --git a/test/language/expressions/class/fields-same-line-async-method-static-private-methods-with-fields.js b/test/language/expressions/class/fields-same-line-async-method-static-private-methods-with-fields.js index 6d6fea3105cfdd60a750b18d1cee20bb7ee54bae..69847657fcc8b2d5fe9563f18458374f35b04235 100644 --- a/test/language/expressions/class/fields-same-line-async-method-static-private-methods-with-fields.js +++ b/test/language/expressions/class/fields-same-line-async-method-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions after an async method in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - async-functions] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-functions] flags: [generated, async] includes: [propertyHelper.js] info: | diff --git a/test/language/expressions/class/fields-same-line-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-same-line-gen-static-private-methods-with-fields.js index 5654534820436a37c54a871fb2060bd386e12ba7..1fdc8bd573ec77d61cc9860df1a606d8000d1acf 100644 --- a/test/language/expressions/class/fields-same-line-gen-static-private-methods-with-fields.js +++ b/test/language/expressions/class/fields-same-line-gen-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions followed by a generator method in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - generators] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, generators] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/expressions/object/method-definition/async-meth-dflt-params-abrupt.js b/test/language/expressions/object/method-definition/async-meth-dflt-params-abrupt.js index 21052dbf34f275995f58b5f0fc850e7d25a07771..d95aa9ca82bac7e815689ee4eac24f9e11bac1a8 100644 --- a/test/language/expressions/object/method-definition/async-meth-dflt-params-abrupt.js +++ b/test/language/expressions/object/method-definition/async-meth-dflt-params-abrupt.js @@ -4,7 +4,7 @@ /*--- description: Abrupt completion returned by evaluation of initializer (async method) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-not-undefined.js b/test/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-not-undefined.js index 005d87f790cb486ddbcb30b347fb6a0529796e50..357e44305c8e96224e5aba4b4626392c44981db1 100644 --- a/test/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-not-undefined.js +++ b/test/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-not-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is not `undefined` (async method) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-undefined.js b/test/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-undefined.js index ba482863db3ddb591347794169c92ce67e8d885c..c768e43fa0f3e1b126c597227120bdc22e09c075 100644 --- a/test/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-undefined.js +++ b/test/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is `undefined` (async method) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-later.js b/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-later.js index 66dc44b258a210f234c46ca57653c4894164322f..3d1574accc8a255f90b51c598862b25a75acb350 100644 --- a/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-later.js +++ b/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-later.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs later in the ParameterList (async method) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-prior.js b/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-prior.js index e73bd575d017039d7d2093a6070a42183e1169ad..896e253e0a1bf749afa37beb2777ad99d0fcfed7 100644 --- a/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-prior.js +++ b/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-prior.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs earlier in the ParameterList (async method) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-self.js b/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-self.js index 4e5a1efd7d864f5e3d9ab735698da4d89f9ae1fa..240e8d2561759cf92e960d4944224cefa5e1c24f 100644 --- a/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-self.js +++ b/test/language/expressions/object/method-definition/async-meth-dflt-params-ref-self.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter from within its own initializer (async method) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/object/method-definition/async-meth-dflt-params-trailing-comma.js b/test/language/expressions/object/method-definition/async-meth-dflt-params-trailing-comma.js index f7420e796f6f8458ab8cb46bca04fd1aab88a7ea..70130e02cb59e0aa9dfbcba319ebdb50e23997e0 100644 --- a/test/language/expressions/object/method-definition/async-meth-dflt-params-trailing-comma.js +++ b/test/language/expressions/object/method-definition/async-meth-dflt-params-trailing-comma.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using default parameters (async method) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/object/method-definition/async-meth-params-trailing-comma-multiple.js b/test/language/expressions/object/method-definition/async-meth-params-trailing-comma-multiple.js index 35ac30a44a2bdc1a073a130c8e50aea4deaa9dc9..3fca4020449b73708d62aa6b030d8b284f430a35 100644 --- a/test/language/expressions/object/method-definition/async-meth-params-trailing-comma-multiple.js +++ b/test/language/expressions/object/method-definition/async-meth-params-trailing-comma-multiple.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using multiple parameters (async method) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/expressions/object/method-definition/async-meth-params-trailing-comma-single.js b/test/language/expressions/object/method-definition/async-meth-params-trailing-comma-single.js index daebc1b10704cb475d74e6100883c49a1ef33f2d..7032cd423e98d0119e0abb19f620ba314c3cee84 100644 --- a/test/language/expressions/object/method-definition/async-meth-params-trailing-comma-single.js +++ b/test/language/expressions/object/method-definition/async-meth-params-trailing-comma-single.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using a single parameter (async method) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/module-code/dynamic-import/catch/eval-rqstd-abrupt-err-type_FIXTURE.js b/test/language/module-code/dynamic-import/catch/eval-rqstd-abrupt-err-type_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..13544ca36ad83b1b42027a6acd87f1f25c733b57 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/eval-rqstd-abrupt-err-type_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +throw new TypeError(); diff --git a/test/language/module-code/dynamic-import/catch/eval-rqstd-abrupt-err-uri_FIXTURE.js b/test/language/module-code/dynamic-import/catch/eval-rqstd-abrupt-err-uri_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..3cdfc0dce74a43820ce34fd430ecd3c51dc1a055 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/eval-rqstd-abrupt-err-uri_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +throw new URIError(); diff --git a/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous-1_FIXTURE.js b/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous-1_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..896bdff50a2e658637ae5144e883a22a8ac6c84c --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous-1_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var x; diff --git a/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous-2_FIXTURE.js b/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous-2_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..896bdff50a2e658637ae5144e883a22a8ac6c84c --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous-2_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var x; diff --git a/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous-export_FIXTURE.js b/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous-export_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..54a857b5d5c4bc14090aca34f649a183b6a85d6f --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous-export_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export { x } from './instn-iee-err-ambiguous_FIXTURE.js'; diff --git a/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous_FIXTURE.js b/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..7857161c3a3b3b73efcf0c353c59a8b9061f1d2c --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/instn-iee-err-ambiguous_FIXTURE.js @@ -0,0 +1,5 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export * from './instn-iee-err-ambiguous-1_FIXTURE.js'; +export * from './instn-iee-err-ambiguous-2_FIXTURE.js'; diff --git a/test/language/module-code/dynamic-import/catch/instn-iee-err-circular-1_FIXTURE.js b/test/language/module-code/dynamic-import/catch/instn-iee-err-circular-1_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..b4a127bfb5690c834d5e719e9e9b424cdff68b58 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/instn-iee-err-circular-1_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export { x } from './instn-iee-err-circular-2_FIXTURE.js'; diff --git a/test/language/module-code/dynamic-import/catch/instn-iee-err-circular-2_FIXTURE.js b/test/language/module-code/dynamic-import/catch/instn-iee-err-circular-2_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..77f5277dfcf82951c45cb8aa6a1d4d4d6b8628c0 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/instn-iee-err-circular-2_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export { x } from './instn-iee-err-circular-1_FIXTURE.js'; diff --git a/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..0f7bac97787a816f049b29854b5fe4dcfce29c53 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +let f = () => { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..3bdc99e8b0d414addabbdf2372b861aaa7848bc5 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +let f = () => { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..c34baf6e113e9a91182d541ea4f87a20bd70abbb --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +let f = () => { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..e5e65ef1850474ee33d3a65c50cf0d5dd1ad4f5f --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +let f = () => { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..91f8f81a3ca4e92b283b889c84fb504b4c924213 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + await import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..e9daf07b5e75872f94b45edcd65863b7312cde3a --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + await import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..1552006ea94730e0df9a47c6b7efb56e723185cd --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +async function f() { + await import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..83fdcad17d24ce95923d5c9baf3c60711ad76fed --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +async function f() { + await import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..308d152f79d71f958887e34013bb0736e67469da --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..6d0ce6732a13b938ac4912768a606d12eb9d9449 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..07bbf77b834df037048b15411d75a881fa42b5cf --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +async function f() { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-async-function-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..91066c830f52ddc023586e8d90ade5d4bd406803 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-instn-iee-err-circular.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +async function f() { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..2fb6935ac1b95ff065efc060d60279676d9a36cd --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + return await import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..d6aa8e5f78e0d28d32537f64034fac96b8d380b4 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + return await import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..78d6aecf84e337d61dd34cdcd44f126671c5817f --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +async function f() { + return await import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..c50b30d53922ca46e9a8d3ca64af75e744283ca2 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +async function f() { + return await import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..b95c6ef39db9ce3a928da9c33df5d42894ffaf16 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +{ + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..e3940ea7ef5840f36ebcda59246f21c4a168760b --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +{ + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..0d3c9e11838165e4db7619300ef4c5fdad425e27 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +{ + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..ecfea070dcc38a1411d9ace8ba140e12f7953202 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +{ + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..f683c024c10f252044c6831c8e4e97b5b1acb6b3 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +label: { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..52587bd07a9b9ae486c8660cc1c1540985ba383e --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +label: { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..f48138ea8b0bcdf0b75f0816621a6f994bc93e8f --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +label: { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..81fc211d7c98590edfb7cd9531d89ea776415ad4 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +label: { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..18f0599a6a552facc1aa26197ca222bd82df9bda --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +do { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} while (false); diff --git a/test/language/module-code/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..6e42f6d2ba89d5deca8dd3cfbab18cade9cfbb85 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +do { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} while (false); diff --git a/test/language/module-code/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..31f8cad6edebdba8412b9f3c3b3960ca68edc1f2 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +do { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} while (false); diff --git a/test/language/module-code/dynamic-import/catch/nested-do-while-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-do-while-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..84f8926624495e481d5e92a51d03669d62f27599 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-do-while-instn-iee-err-circular.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +do { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} while (false); diff --git a/test/language/module-code/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..8932da53347ebc744de49e5ccb346ba75b37f802 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +if (false) { + +} else { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..94389102dfb3d3772d9e0ba5515bf8622677e1df --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +if (false) { + +} else { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..669261a50189390d3b26bd4dcebb349714cd6fdd --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +if (false) { + +} else { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..5027242a8856ad44083b8b85cda96358569542b0 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +if (false) { + +} else { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..b54ced6c002b85fd45d8c6d129b3d1764094143d --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +function f() { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..1b6661ea712bec702283d44741460ed78faaefc3 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +function f() { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..fc8e6e03d683594b92616e4addc4a2905a0a8142 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +function f() { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..3fbd7840933affc08c331ea1cdf40f8ffd447e34 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +function f() { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} +f(); diff --git a/test/language/module-code/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..b7a79ce84901ec27a24e32097bdad5788eca28cb --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +if (true) { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..49cb759b7c7a391fa16480387435946dffdd8769 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +if (true) { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..3a382d521e9ef0a441bc86768886221419dc0b27 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +if (true) { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..fdc419257fbe598af5eb8148dc297d963d2cb11d --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +if (true) { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/test/language/module-code/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..0fd5bc9c78562031a4f53eef14061b459a8f419c --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +let x = 0; +while (!x) { + x++; + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..87efb2aef4ddd79d270ff84e4e39c36788bc5e70 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +let x = 0; +while (!x) { + x++; + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..3cf222c669f9a4da7373450a3d5b44edf4d65098 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +let x = 0; +while (!x) { + x++; + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..d40425dcd4cc4478ca47007d355614f71389b729 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +let x = 0; +while (!x) { + x++; + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/test/language/module-code/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror.js b/test/language/module-code/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000000000000000000000000000000000..e3202fa54991c6e2925e564962342540173b7a12 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + +}).then($DONE, $DONE); diff --git a/test/language/module-code/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror.js b/test/language/module-code/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000000000000000000000000000000000..e67df2a4c2480d29b425567854293117020ba179 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + +}).then($DONE, $DONE); diff --git a/test/language/module-code/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import.js b/test/language/module-code/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000000000000000000000000000000000..3231dd225e28eba821eebeffb8a457559d05eff9 --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/test/language/module-code/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular.js b/test/language/module-code/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000000000000000000000000000000000..f49b06629f66c394762c9a0f80d872d6a0e392bc --- /dev/null +++ b/test/language/module-code/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-cls-anon.js b/test/language/module-code/dynamic-import/eval-export-dflt-cls-anon.js new file mode 100644 index 0000000000000000000000000000000000000000..82df8ee589be395f0a4613da4f3156d3679040a4 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-cls-anon.js @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default "anonymous" class declaration is correctly initialized upon + evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + Runtime Semantics: Evaluation + + ExportDeclaration : export default ClassDeclaration + + [...] + 3. Let className be the sole element of BoundNames of ClassDeclaration. + 4. If className is "*default*", then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + c. Let env be the running execution context's LexicalEnvironment. + d. Perform ? InitializeBoundName("*default*", value, env). + 5. Return NormalCompletion(empty). +flags: [async, module] +features: [dynamic-import] +---*/ + +export default class { valueOf() { return 45; } } +import('./eval-export-dflt-cls-anon.js').then(imported => { + assert.sameValue(new imported.default().valueOf(), 45, 'binding initialized'); + assert.sameValue(imported.default.name, 'default', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); + diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-cls-name-meth.js b/test/language/module-code/dynamic-import/eval-export-dflt-cls-name-meth.js new file mode 100644 index 0000000000000000000000000000000000000000..171e2f5924bcbf85241ab1e782cd65fad78d7508 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-cls-name-meth.js @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default "anonymous" class declaration containing a static `name` method is + correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default ClassDeclaration + + [...] + 3. Let className be the sole element of BoundNames of ClassDeclaration. + 4. If className is "*default*", then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + c. Let env be the running execution context's LexicalEnvironment. + d. Perform ? InitializeBoundName("*default*", value, env). + 5. Return NormalCompletion(empty). +flags: [async, module] +features: [dynamic-import] +---*/ + +export default class { static name() { return 'name method'; } } +import('./eval-export-dflt-cls-name-meth.js').then(imported => { + assert.sameValue(imported.default.name(), 'name method', '`name` property is not over-written'); +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-cls-named.js b/test/language/module-code/dynamic-import/eval-export-dflt-cls-named.js new file mode 100644 index 0000000000000000000000000000000000000000..1cc6655ffb604b59161a524251477f508e76fa19 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-cls-named.js @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default "named" class declaration is correctly initialized upon + evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default ClassDeclaration + + [...] + 3. Let className be the sole element of BoundNames of ClassDeclaration. + 4. If className is "*default*", then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + c. Let env be the running execution context's LexicalEnvironment. + d. Perform ? InitializeBoundName("*default*", value, env). + 5. Return NormalCompletion(empty). +flags: [async, module] +features: [dynamic-import] +---*/ + +export default class cName { valueOf() { return 45; } } +import('./eval-export-dflt-cls-named.js').then(imported => { + assert.sameValue(new imported.default().valueOf(), 45, 'binding initialized'); + assert.sameValue(imported.default.name, 'cName', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); + diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-anon.js b/test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-anon.js new file mode 100644 index 0000000000000000000000000000000000000000..e9315008849a9cd6b6ee07b7e4b1b83a0841db1d --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-anon.js @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as an "anonymous" + class declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (class { valueOf() { return 45; } }); +import('./eval-export-dflt-expr-cls-anon.js').then(imported => { + assert.sameValue(new imported.default().valueOf(), 45, 'binding initialized'); + assert.sameValue(imported.default.name, 'default', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-name-meth.js b/test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-name-meth.js new file mode 100644 index 0000000000000000000000000000000000000000..9022281142021d68f4da982af01bfa43d7630054 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-name-meth.js @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as an "anonymous" + class declaration with a static `name` method) is correctly initialized + upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default ClassDeclaration + + [...] + 3. Let className be the sole element of BoundNames of ClassDeclaration. + 4. If className is "*default*", then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + c. Let env be the running execution context's LexicalEnvironment. + d. Perform ? InitializeBoundName("*default*", value, env). + 5. Return NormalCompletion(empty). +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (class { static name() { return 'name method'; } }); +import('./eval-export-dflt-expr-cls-name-meth.js').then(imported => { + assert.sameValue(imported.default.name(), 'name method', '`name` property is not over-written'); +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-named.js b/test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-named.js new file mode 100644 index 0000000000000000000000000000000000000000..45713a0b6409745d63039872c64933e19a780f80 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-expr-cls-named.js @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as a "named" class + declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (class cName { valueOf() { return 45; } }); +import('./eval-export-dflt-expr-cls-named.js').then(imported => { + assert.sameValue(new imported.default().valueOf(), 45, 'binding initialized'); + assert.sameValue(imported.default.name, 'cName', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-expr-fn-anon.js b/test/language/module-code/dynamic-import/eval-export-dflt-expr-fn-anon.js new file mode 100644 index 0000000000000000000000000000000000000000..e317fbd6cf703f097bb292c499928abee15d5752 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-expr-fn-anon.js @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as an "anonymous" + function declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (function() { return 99; }); +import('./eval-export-dflt-expr-fn-anon.js').then(imported => { + assert.sameValue(imported.default(), 99, 'binding initialized'); + assert.sameValue(imported.default.name, 'default', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-expr-fn-named.js b/test/language/module-code/dynamic-import/eval-export-dflt-expr-fn-named.js new file mode 100644 index 0000000000000000000000000000000000000000..10c417eb432b32a9de2fadae65a20d511d690336 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-expr-fn-named.js @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as a "named" function + declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (function fName() { return 7; }); +import('./eval-export-dflt-expr-fn-named.js').then(imported => { + assert.sameValue(imported.default(), 7, 'binding initialized'); + assert.sameValue(imported.default.name, 'fName', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-expr-gen-anon.js b/test/language/module-code/dynamic-import/eval-export-dflt-expr-gen-anon.js new file mode 100644 index 0000000000000000000000000000000000000000..8ad18cf2fcc3a47819cd9755964581458b96d422 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-expr-gen-anon.js @@ -0,0 +1,35 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as an "anonymous" + generator function declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import, generators] +---*/ + +export default (function* () { return 24601; }); +import('./eval-export-dflt-expr-gen-anon.js').then(imported => { + assert.sameValue(imported.default().next().value, 24601, 'binding initialized'); + assert.sameValue(imported.default.name, 'default', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); + diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-expr-gen-named.js b/test/language/module-code/dynamic-import/eval-export-dflt-expr-gen-named.js new file mode 100644 index 0000000000000000000000000000000000000000..cb5ebdbd844276e41d99939a3ca5f3283541133d --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-expr-gen-named.js @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as a "named" + generator function declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import, generators] +---*/ + +export default (function* gName() { return 42; }); +import('./eval-export-dflt-expr-gen-named.js').then(imported => { + assert.sameValue(imported.default().next().value, 42, 'binding initialized'); + assert.sameValue(imported.default.name, 'gName', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/eval-export-dflt-expr-in.js b/test/language/module-code/dynamic-import/eval-export-dflt-expr-in.js new file mode 100644 index 0000000000000000000000000000000000000000..ea6dc3f8372ca7f4bf60ae95a73b3a7a6cedb1c3 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-export-dflt-expr-in.js @@ -0,0 +1,28 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + The `in` operator may occur within an exported AssignmentExpression +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3 Exports + + Syntax + + ExportDeclaration : + + export default [lookahead ∉ { function, class }] AssignmentExpression[In]; +flags: [async, module] +features: [dynamic-import] +---*/ +var x = { x: true }; + +export default 'x' in x; +import('./eval-export-dflt-expr-in.js').then(imported => { + assert.sameValue(imported.default, true); +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/eval-rqstd-once.js b/test/language/module-code/dynamic-import/eval-rqstd-once.js new file mode 100644 index 0000000000000000000000000000000000000000..997f71a96145be4011226ea7469a643a24cceb32 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-rqstd-once.js @@ -0,0 +1,31 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Requested modules are evaluated exactly once +esid: sec-moduleevaluation +info: | + [...] + 4. If module.[[Evaluated]] is true, return undefined. + 5. Set module.[[Evaluated]] to true. + 6. For each String required that is an element of module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + [...] +includes: [fnGlobalObject.js] +flags: [async] +features: [dynamic-import] +---*/ + +var global = fnGlobalObject(); + +Promise.all([ + import('./eval-rqstd-once_FIXTURE.js'), + import('./eval-rqstd-once_FIXTURE.js'), +]).then(async () => { + // Use await to serialize imports + await import('./eval-rqstd-once_FIXTURE.js'); + await import('./eval-rqstd-once_FIXTURE.js'); + + assert.sameValue(global.test262, 262, 'global property was defined'); +}).then($DONE, $DONE); diff --git a/test/language/module-code/dynamic-import/eval-rqstd-once_FIXTURE.js b/test/language/module-code/dynamic-import/eval-rqstd-once_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..8af3363daf3d8842324f8e50d9427ef2d941362c --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-rqstd-once_FIXTURE.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export default null; +var global = Function('return this;')(); + +if (global.test262) { + throw new Error('Module was evaluated more than once.'); +} + +global.test262 = 262; + +if (global.test262 !== 262) { + throw new Error('Module was unable to signal evaluation.'); +} diff --git a/test/language/module-code/dynamic-import/eval-self-once-module.js b/test/language/module-code/dynamic-import/eval-self-once-module.js new file mode 100644 index 0000000000000000000000000000000000000000..2ded0764ad369f07ed73eb0cf7c19644a2fbdb59 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-self-once-module.js @@ -0,0 +1,39 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Module is evaluated exactly once +esid: sec-moduleevaluation +info: | + [...] + 4. If module.[[Evaluated]] is true, return undefined. + 5. Set module.[[Evaluated]] to true. + 6. For each String required that is an element of module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + [...] + + This test is meant to be flagged as module code, it should not initially + run as script code or the result will not be the same. +includes: [fnGlobalObject.js] +flags: [async, module] +features: [dynamic-import] +---*/ + +var global = fnGlobalObject(); + +if (typeof global.evaluated === 'undefined') { + global.evaluated = 0; +} + +global.evaluated++; + +Promise.all([ + import('./eval-self-once-module.js'), + import('./eval-self-once-module.js'), +]).then(async () => { + // Use await to serialize imports + await import('./eval-self-once-module.js'); + await import('./eval-self-once-module.js'); + + assert.sameValue(global.evaluated, 1, 'global property was defined and incremented only once'); +}).then($DONE, $DONE); diff --git a/test/language/module-code/dynamic-import/eval-self-once-script.js b/test/language/module-code/dynamic-import/eval-self-once-script.js new file mode 100644 index 0000000000000000000000000000000000000000..03b1288ecfb369c5d16009f492aa2213444ba013 --- /dev/null +++ b/test/language/module-code/dynamic-import/eval-self-once-script.js @@ -0,0 +1,38 @@ +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Script is evaluated exactly once after loaded by import +esid: sec-hostimportmoduledynamically +info: | + Success path + + The completion value of any subsequent call to HostResolveImportedModule after + FinishDynamicImport has completed, given the arguments referencingScriptOrModule + and specifier, must be a module which has already been evaluated, i.e. whose + Evaluate concrete method has already been called and returned a normal completion. + + This test is meant to __not__ be flagged as module code, it should not initially + run as module code or the result will not be the same. +includes: [fnGlobalObject.js] +flags: [async] +features: [dynamic-import] +---*/ + +var global = fnGlobalObject(); + +if (typeof global.evaluated === 'undefined') { + global.evaluated = 0; +} + +global.evaluated++; + +Promise.all([ + import('./eval-self-once-script.js'), + import('./eval-self-once-script.js'), +]).then(async () => { + // Use await to serialize imports + await import('./eval-self-once-script.js'); + await import('./eval-self-once-script.js'); + + assert.sameValue(global.evaluated, 2, 'global property was defined and incremented only once'); +}).then($DONE, $DONE); diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..96a8bb62471b251709598357f410057c9a1f2001 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-arrow.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +let f = () => { + import(); +}; + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..825bdf5c31337669f0311246254dfe8ed1e7dff5 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +let f = () => import(); + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..622142e8491fda5307e522e61413388d2d996e83 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-function.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + import(); +} + + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..f36a527edc33433b4bcd9beb2a5e898deb2e0e7a --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-function-await.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + await import(); +} + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..e4bc337d8c4eb835f4aa0ceb6853269f86fc53a5 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +async function f() { + return await import(); +} + + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..7867d2a4e91116cdb91e7be16452c09743c875e7 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-block.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +{ + import(); +}; + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..6296b903bc54ca669fd91eb8719b491c23e4db58 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-block-labeled.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +label: { + import(); +}; + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..a1bbe92af5dc4aa72c88e42837b8f22927e5039b --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-do-while.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +do { + import(); +} while (false); + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..00dce8cf5c7ad45f3bf2312851ba2929d54a785b --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (false) { + +} else { + import(); +} + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..1e691f817d9d808344d56258ba94cdfd2782f957 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-else-braceless.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (false) { + +} else import(); + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..4873ae664c42f804f9b0064a6aabb28280c467b8 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-function.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +function fn() { + import(); +} + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..4a10c5de24948f75d726f9d8e719a729d015e7a8 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-function-return.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +function fn() { + return import(); +} + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..d0a3ff0af4b4302811883a584f97c7cdd5fd62bb --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-if.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (true) { + import(); +} + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..af0f9caa7e8bc95998c166fbb4c9874eca79fcbf --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-if-braceless.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +if (true) import(); + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..25cdafb6f5d12832d8ef4725854dd6d2fe49fca4 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +let x = 0; +while (!x) { + x++; + import(); +}; + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js b/test/language/module-code/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js new file mode 100644 index 0000000000000000000000000000000000000000..32810c3d8baaba9296e8a32126842b208e809404 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +throw "Test262: This statement should not be evaluated."; + +import(); + +/* The params region intentionally empty */ diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..7273a33e6c12a18acccd7949e5e1b920d878990d --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => import(''); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..ee7b9aacec609fb1d4b97489863c95223a6c56cd --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-arrow-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => { + import(''); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..b4a5f064a1a8e633602ae6a041a726b23cab6aed --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + await import(''); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..e78fe924e2c1bdf05b7d39717f5cc795a4c02d0e --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + import(''); +} + diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..cefd94df23535b10448990631a8653e84e5487df --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + return await import(''); +} + diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-block-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-block-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..a378d1e5c9bd0236dcbed9cea67dccbdb6f59ae1 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-block-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: Calling import('') (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +{ + import(''); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-block-labeled-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-block-labeled-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..9ffbdcc966c4391200bbaec0447dbdb3d1102dae --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-block-labeled-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: Calling import('') (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +label: { + import(''); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-do-while-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-do-while-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..06f4dcb7ff21c989e19ce3774d183d8d50e0e789 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-do-while-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: Calling import('') (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +do { + import(''); +} while (false); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-else-braceless-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-else-braceless-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..28ceeff271ee2a4ce21a6036005dcce7bae642b4 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-else-braceless-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: Calling import('') (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (false) { + +} else import(''); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-else-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-else-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..aebecfe1cf64889efe584633e0dbaee58d1d1c1c --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-else-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: Calling import('') (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (false) { + +} else { + import(''); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..d6358b05fa59a50b2aa912207acc412755cae564 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: Calling import('') (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +function fn() { + import(''); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..e1238bcfdb05e15ec239af45ce009e5f7ab0f1b3 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: Calling import('') (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +function fn() { + return import(''); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-if-braceless-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-if-braceless-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..b78fe6fb513864648623a1d88d00876d1611460e --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-if-braceless-empty-str-is-valid-assign-expr.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: Calling import('') (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) import(''); diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-if-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-if-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..cd72980e4913e3edad4d5dd332fd9c84115b9e8b --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-if-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: Calling import('') (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) { + import(''); +} diff --git a/test/language/module-code/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..06ed77a9dfb63520d4fb5a3d4ebc7015451d4e16 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: Calling import('') (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let x = 0; +while (!x) { + x++; + import(''); +}; diff --git a/test/language/module-code/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js b/test/language/module-code/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..ed13876b70ec0052db4c3b3c994ed588eb43c5c5 --- /dev/null +++ b/test/language/module-code/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js @@ -0,0 +1,15 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: Calling import('') (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module] +info: | + ImportCall : + import( AssignmentExpression ) + +---*/ + +import(''); diff --git a/test/language/module-code/dynamic-import/usage/dynamic-import-module_FIXTURE.js b/test/language/module-code/dynamic-import/usage/dynamic-import-module_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..ef3f4207cd745179e169cb1aa8776c167dfe7d21 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/dynamic-import-module_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var x = 1; diff --git a/test/language/module-code/dynamic-import/usage/eval-gtbndng-indirect-update-dflt_FIXTURE.js b/test/language/module-code/dynamic-import/usage/eval-gtbndng-indirect-update-dflt_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..61b27a569e0e35bdf5a37206a31d672c5964f4ba --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/eval-gtbndng-indirect-update-dflt_FIXTURE.js @@ -0,0 +1,7 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export default function fn() { + fn = 2; + return 1; +} diff --git a/test/language/module-code/dynamic-import/usage/eval-gtbndng-indirect-update_FIXTURE.js b/test/language/module-code/dynamic-import/usage/eval-gtbndng-indirect-update_FIXTURE.js new file mode 100644 index 0000000000000000000000000000000000000000..bd505a021010f838de6fbc2236f3ec8b0a3e657e --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/eval-gtbndng-indirect-update_FIXTURE.js @@ -0,0 +1,9 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +var x = 1; +export { x }; + +Function('return this;')().test262update = function() { + x = 2; +}; diff --git a/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..36f15d8f8a6b5b456a0884d414492ef7788fa41e --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let f = () => import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..1583daf5548e253b1f43ab0913bfc9424de3d647 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let f = () => import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..463c475f53724b019709e4856bfc36641bc327e9 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-arrow-assignment-expression-returns-promise.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: Dynamic import() returns a Promise object. (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..a0bf48a3171556a978b4ab2c98cbd7fd47234bc5 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let f = () => { + return import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..c1635683d57fa4979a6da04df85631c0d06388d8 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let f = () => { + return import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..0a5edbe9bccf23438a17ab545d31150c827061cb --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-arrow-import-then-returns-promise.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: Dynamic import() returns a Promise object. (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => { + return import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..b8c3d616c2520169efbc35a4f91e53cbc50e1b2d --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + await import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..709f3cb835b17750d030ebf20fd4e3512d5e0363 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + await import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-await-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-async-function-await-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..065feb806fa2ed1f4034ebb27354298a9c7ce58e --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-await-returns-promise.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: Dynamic import() returns a Promise object. (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + await import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..1ef68166f6f8eb586bd774ff5f281adc6312bf28 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..6cd13636689afac7801610a7d454761a8e1ef895 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..c93c23756e2e265e2a0c3f79bc446419ed548ca8 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + return await import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js'); +} + +f().then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..51efea8fe9f62971bbd4cf7d0c0fd24138c139f6 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + return await import('./eval-gtbndng-indirect-update_FIXTURE.js'); +} + +f().then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..135a98225e975281d617ec4033a0f1fb9093a75b --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-return-await-returns-promise.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: Dynamic import() returns a Promise object. (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + return await import('./dynamic-import-module_FIXTURE.js'); +} + +f().then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-async-function-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-async-function-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..435b3e0d3eb044510e3070e31f343716ef6fa31d --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-async-function-returns-promise.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: Dynamic import() returns a Promise object. (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/test/language/module-code/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..53df067f508ee4dc430ee31bbdb6d9405f762ee1 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +{ + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..9e91b0f93a831c3012db33455558c222d4798a24 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +{ + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/nested-block-import-then-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-block-import-then-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..997722f9668ee1ebd35ca7b83f83f1bf843dae55 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-block-import-then-returns-promise.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: Dynamic import() returns a Promise object. (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +{ + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..05280a20cb3e3a0cc717364028e3415a4d7f8e04 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +do { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/test/language/module-code/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..dc299c152683787bfc113113f375fd5ab4749434 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +do { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/test/language/module-code/dynamic-import/usage/nested-do-while-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-do-while-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..1907481f2c7c9c4f6b71720e75f5584242c33c92 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-do-while-returns-promise.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: Dynamic import() returns a Promise object. (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +do { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/test/language/module-code/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..8d720dfcdd870ccc582b43a4dc729231158fec32 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (false) { + +} else { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..76881bbd68b46c4d48c21e204b48512ec3336b60 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (false) { + +} else { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-else-import-then-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-else-import-then-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..afde7ff219eaa66bea140f856f66813b2858e637 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-else-import-then-returns-promise.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: Dynamic import() returns a Promise object. (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (false) { + +} else { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..1569bca4ef79de545810715c19babafa42e6da99 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +function f() { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/test/language/module-code/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..2b0717cc51bef7430bcbb730bb58913386e584b0 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +function f() { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/test/language/module-code/dynamic-import/usage/nested-function-import-then-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-function-import-then-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..ab2ff9bfa3be3c3ceb2c9e59109e62a4a0a9770f --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-function-import-then-returns-promise.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: Dynamic import() returns a Promise object. (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +function f() { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/test/language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..537bdd60118e8c2e4837547977828de157e402de --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (true) import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..fe09649d9be98b3e2217ec38c7284ff393da68aa --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (true) import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-if-braceless-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-if-braceless-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..37710f3aadb0cd19abfefcdf278f0f821819b7a3 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-if-braceless-returns-promise.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: Dynamic import() returns a Promise object. (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..d895ed03eedf3a57deeb38cb553940071b381ede --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (true) { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..42c3fbf79f7c007b1fafdfd147278ad27b77edbb --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (true) { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-if-import-then-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-if-import-then-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..57f9e7dc83a69a7a2a5f2b738859ab379f739e87 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-if-import-then-returns-promise.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: Dynamic import() returns a Promise object. (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/test/language/module-code/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..5cb4e56d166769b130fa6b272e4e16eae47aff98 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let x = 0; +while (!x) { + x++; + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..d2e757df6a19eee6470afc41ee055e66949b7d0c --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let x = 0; +while (!x) { + x++; + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/nested-while-import-then-returns-promise.js b/test/language/module-code/dynamic-import/usage/nested-while-import-then-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..f4bef3e87ba6de20c56a7be2dc867d45b39fb916 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/nested-while-import-then-returns-promise.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: Dynamic import() returns a Promise object. (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let x = 0; +while (!x) { + x++; + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..baf1bf0076f8ab2d8b9c4771d5204ffe60111d38 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +label: { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..e0c0154087a239f40f3b45d1a0761810c3251d77 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +label: { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-returns-promise.js b/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..877e77c22e6389ac939904e188fb49b447ab90da --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/syntax-nested-block-labeled-returns-promise.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: Dynamic import() returns a Promise object. (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +label: { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/test/language/module-code/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt.js b/test/language/module-code/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..261bd82510c1feee0ea831d2d9e8c4c7f9ffe786 --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/top-level.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update.js b/test/language/module-code/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000000000000000000000000000000000..2a476f804f30db7b46b2e07bdceb7c664cf92b5d --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/top-level.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/module-code/dynamic-import/usage/top-level-import-then-returns-promise.js b/test/language/module-code/dynamic-import/usage/top-level-import-then-returns-promise.js new file mode 100644 index 0000000000000000000000000000000000000000..626bc97edaf199f7e2110e7883a61aff53a32c0c --- /dev/null +++ b/test/language/module-code/dynamic-import/usage/top-level-import-then-returns-promise.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-promise.case +// - src/dynamic-import/default/top-level.template +/*--- +description: Dynamic import() returns a Promise object. (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/test/language/statements/async-function/dflt-params-abrupt.js b/test/language/statements/async-function/dflt-params-abrupt.js index 90a7c98c3b87d96c1bc784b42ec404edf08e700a..5c0e45fe8e4d7976d904b87d3780af2f3a468c70 100644 --- a/test/language/statements/async-function/dflt-params-abrupt.js +++ b/test/language/statements/async-function/dflt-params-abrupt.js @@ -4,7 +4,7 @@ /*--- description: Abrupt completion returned by evaluation of initializer (async function declaration) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/statements/async-function/dflt-params-arg-val-not-undefined.js b/test/language/statements/async-function/dflt-params-arg-val-not-undefined.js index 2a9be96dca5ecde9a835a48115b34a58b7cf73f0..4b00c06a8616065aa80b1f692fcfa72e003e9f0d 100644 --- a/test/language/statements/async-function/dflt-params-arg-val-not-undefined.js +++ b/test/language/statements/async-function/dflt-params-arg-val-not-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is not `undefined` (async function declaration) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/statements/async-function/dflt-params-arg-val-undefined.js b/test/language/statements/async-function/dflt-params-arg-val-undefined.js index f317dcf3a2c54f5666aa39a33457005c4f17aca1..a81dd928ffc71095d5eecb12289db7729d112f84 100644 --- a/test/language/statements/async-function/dflt-params-arg-val-undefined.js +++ b/test/language/statements/async-function/dflt-params-arg-val-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is `undefined` (async function declaration) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/statements/async-function/dflt-params-duplicates.js b/test/language/statements/async-function/dflt-params-duplicates.js index 4e81940af0f1045eba86f00feeb60a97d9f6b1bf..fffc4c4c04340d3f2f9f409b87f976c1841c1d0a 100644 --- a/test/language/statements/async-function/dflt-params-duplicates.js +++ b/test/language/statements/async-function/dflt-params-duplicates.js @@ -4,7 +4,7 @@ /*--- description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async function declaration) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated] negative: phase: parse @@ -15,6 +15,7 @@ info: | AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + 14.1.2 Static Semantics: Early Errors StrictFormalParameters : FormalParameters diff --git a/test/language/statements/async-function/dflt-params-ref-later.js b/test/language/statements/async-function/dflt-params-ref-later.js index aa56ea0dcf5a3f6716a27b5889402fb9d85a0370..b48aef99f4e76a1dd1b92e2fb4846ea04c97ba96 100644 --- a/test/language/statements/async-function/dflt-params-ref-later.js +++ b/test/language/statements/async-function/dflt-params-ref-later.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs later in the ParameterList (async function declaration) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/statements/async-function/dflt-params-ref-prior.js b/test/language/statements/async-function/dflt-params-ref-prior.js index b97df71c5292ebb64c73f5d289fff7fe6c800803..e231b28dbb1f6498d20dc9b1c5f3a813f314a5c7 100644 --- a/test/language/statements/async-function/dflt-params-ref-prior.js +++ b/test/language/statements/async-function/dflt-params-ref-prior.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs earlier in the ParameterList (async function declaration) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/statements/async-function/dflt-params-ref-self.js b/test/language/statements/async-function/dflt-params-ref-self.js index 714f611e92cfed6b29999c90cb01c51fc7c0c743..9749433e228f4c6e762b3d61e8529bae2e7811f4 100644 --- a/test/language/statements/async-function/dflt-params-ref-self.js +++ b/test/language/statements/async-function/dflt-params-ref-self.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter from within its own initializer (async function declaration) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/statements/async-function/dflt-params-rest.js b/test/language/statements/async-function/dflt-params-rest.js index 4fe7c6ade37206aad706c54cd46b11f77823ede1..dccd916c9060c597dad036fb4d01269309262eea 100644 --- a/test/language/statements/async-function/dflt-params-rest.js +++ b/test/language/statements/async-function/dflt-params-rest.js @@ -4,7 +4,7 @@ /*--- description: RestParameter does not support an initializer (async function declaration) esid: sec-async-function-definitions -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated] negative: phase: parse @@ -15,6 +15,7 @@ info: | AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + 14.1 Function Definitions Syntax diff --git a/test/language/statements/async-function/dflt-params-trailing-comma.js b/test/language/statements/async-function/dflt-params-trailing-comma.js index f4fb4deb651169b6b37b80f31f81a34842e804dd..2729ffd19a336f146e1a9ad8a969e342415c5d90 100644 --- a/test/language/statements/async-function/dflt-params-trailing-comma.js +++ b/test/language/statements/async-function/dflt-params-trailing-comma.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using default parameters (async function declaration) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/statements/async-function/params-trailing-comma-multiple.js b/test/language/statements/async-function/params-trailing-comma-multiple.js index 5a74e80f7cd11eeb33f50fb0b389d939611f0bbb..ff37f6c31c0ccee5e0086791c99d9d4711d9d2ff 100644 --- a/test/language/statements/async-function/params-trailing-comma-multiple.js +++ b/test/language/statements/async-function/params-trailing-comma-multiple.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using multiple parameters (async function declaration) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/statements/async-function/params-trailing-comma-single.js b/test/language/statements/async-function/params-trailing-comma-single.js index 3a88578ec0f79c202eec0c4655eec90043152c9c..23071b6f41aeaee3703285b66a9ecdcfa9b8281a 100644 --- a/test/language/statements/async-function/params-trailing-comma-single.js +++ b/test/language/statements/async-function/params-trailing-comma-single.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using a single parameter (async function declaration) esid: sec-async-function-definitions +features: [async-functions] flags: [generated, async] info: | 14.6 Async Function Definitions diff --git a/test/language/statements/async-function/rest-params-trailing-comma-early-error.js b/test/language/statements/async-function/rest-params-trailing-comma-early-error.js index 99c390295bef6d024cc1cfc5111de38126b9a031..c29555f3164ffa454aa05ea53b2d9adf7089be9d 100644 --- a/test/language/statements/async-function/rest-params-trailing-comma-early-error.js +++ b/test/language/statements/async-function/rest-params-trailing-comma-early-error.js @@ -4,6 +4,7 @@ /*--- description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async function declaration) esid: sec-async-function-definitions +features: [async-functions] flags: [generated] negative: phase: parse @@ -14,6 +15,7 @@ info: | AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + Trailing comma in the parameters list 14.1 Function Definitions diff --git a/test/language/statements/class/async-meth-dflt-params-abrupt.js b/test/language/statements/class/async-meth-dflt-params-abrupt.js index 6fb6af006880cdd59dd1a9e2a5112dfb3484099e..74d6f3cde3e4183167dfe1f4dd1c47c08b0833d4 100644 --- a/test/language/statements/class/async-meth-dflt-params-abrupt.js +++ b/test/language/statements/class/async-meth-dflt-params-abrupt.js @@ -4,7 +4,7 @@ /*--- description: Abrupt completion returned by evaluation of initializer (class declaration async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-dflt-params-arg-val-not-undefined.js b/test/language/statements/class/async-meth-dflt-params-arg-val-not-undefined.js index b7defcbba19a72d3dd99729978114751e60e87f5..9f44cf96540dcd1f60722e6d51f8916370ab20b4 100644 --- a/test/language/statements/class/async-meth-dflt-params-arg-val-not-undefined.js +++ b/test/language/statements/class/async-meth-dflt-params-arg-val-not-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is not `undefined` (class declaration async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-dflt-params-arg-val-undefined.js b/test/language/statements/class/async-meth-dflt-params-arg-val-undefined.js index ef21786bfa7e86dbf52ca28989e078efc4ae1548..78dd965deb8f8126375380e0a8b54177209a54fb 100644 --- a/test/language/statements/class/async-meth-dflt-params-arg-val-undefined.js +++ b/test/language/statements/class/async-meth-dflt-params-arg-val-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is `undefined` (class declaration async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-dflt-params-ref-later.js b/test/language/statements/class/async-meth-dflt-params-ref-later.js index 673c3e4e7c622fab6cd7fb4343fdc43498b554c7..eac3fdf73e73a4fd3deba9a4198065b7e7f79c2f 100644 --- a/test/language/statements/class/async-meth-dflt-params-ref-later.js +++ b/test/language/statements/class/async-meth-dflt-params-ref-later.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs later in the ParameterList (class declaration async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-dflt-params-ref-prior.js b/test/language/statements/class/async-meth-dflt-params-ref-prior.js index f6eae505d419fd2eb81faea38a3c44c32c53f21f..8d702ad7e222a8903f5402a3f6e79b2873331cae 100644 --- a/test/language/statements/class/async-meth-dflt-params-ref-prior.js +++ b/test/language/statements/class/async-meth-dflt-params-ref-prior.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs earlier in the ParameterList (class declaration async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-dflt-params-ref-self.js b/test/language/statements/class/async-meth-dflt-params-ref-self.js index b85d2c1c134b5bfba652a46cf4d9ca02629bf9c5..0991319eff5ff38b29baeb13b7c68ca2efa96759 100644 --- a/test/language/statements/class/async-meth-dflt-params-ref-self.js +++ b/test/language/statements/class/async-meth-dflt-params-ref-self.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter from within its own initializer (class declaration async method) esid: sec-class-definitions-runtime-semantics-evaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-dflt-params-trailing-comma.js b/test/language/statements/class/async-meth-dflt-params-trailing-comma.js index 2dfc6a9888fbf6cae0dd7f7ffba101b077f891cb..4c36832e32df15e09b1f39c734ffda57baea70a9 100644 --- a/test/language/statements/class/async-meth-dflt-params-trailing-comma.js +++ b/test/language/statements/class/async-meth-dflt-params-trailing-comma.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using default parameters (class declaration async method) esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-params-trailing-comma-multiple.js b/test/language/statements/class/async-meth-params-trailing-comma-multiple.js index 3ceb1d6d58940e04786690b3de05c499d72ea843..a04e242e2da6717b4a63bce133b1e9642503c3ab 100644 --- a/test/language/statements/class/async-meth-params-trailing-comma-multiple.js +++ b/test/language/statements/class/async-meth-params-trailing-comma-multiple.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using multiple parameters (class declaration async method) esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-params-trailing-comma-single.js b/test/language/statements/class/async-meth-params-trailing-comma-single.js index 5b86f97ee407e0511f68f85a48ec105b334406aa..bd127f0ca21c51378c7e8f30d5b84a638604b976 100644 --- a/test/language/statements/class/async-meth-params-trailing-comma-single.js +++ b/test/language/statements/class/async-meth-params-trailing-comma-single.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using a single parameter (class declaration async method) esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-static-dflt-params-abrupt.js b/test/language/statements/class/async-meth-static-dflt-params-abrupt.js index 3d58d2ab3da33eb026d172c1e7310e5a61437dd1..2f97aa6fea90221d23e9b0579dd5ebcfcf4228bb 100644 --- a/test/language/statements/class/async-meth-static-dflt-params-abrupt.js +++ b/test/language/statements/class/async-meth-static-dflt-params-abrupt.js @@ -4,7 +4,7 @@ /*--- description: Abrupt completion returned by evaluation of initializer (static class declaration async method) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-static-dflt-params-arg-val-not-undefined.js b/test/language/statements/class/async-meth-static-dflt-params-arg-val-not-undefined.js index 58021d82900d5d756f52ad41d1a52eff6fcf7f32..8988a844afbc1f5f60f3dea215aef805b0799cc4 100644 --- a/test/language/statements/class/async-meth-static-dflt-params-arg-val-not-undefined.js +++ b/test/language/statements/class/async-meth-static-dflt-params-arg-val-not-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is not `undefined` (static class declaration async method) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-static-dflt-params-arg-val-undefined.js b/test/language/statements/class/async-meth-static-dflt-params-arg-val-undefined.js index 31d0885c931ed3144643abaa0f05358e4f65798f..cd8bf2a6efce4948a242786965e3702feff88d5e 100644 --- a/test/language/statements/class/async-meth-static-dflt-params-arg-val-undefined.js +++ b/test/language/statements/class/async-meth-static-dflt-params-arg-val-undefined.js @@ -4,7 +4,7 @@ /*--- description: Use of initializer when argument value is `undefined` (static class declaration async method) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-static-dflt-params-ref-later.js b/test/language/statements/class/async-meth-static-dflt-params-ref-later.js index f089ed85535515e254c175324ee90cb66a99e97f..235d1f04cda07b1f53e688e441dc8492639c6ddb 100644 --- a/test/language/statements/class/async-meth-static-dflt-params-ref-later.js +++ b/test/language/statements/class/async-meth-static-dflt-params-ref-later.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs later in the ParameterList (static class declaration async method) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-static-dflt-params-ref-prior.js b/test/language/statements/class/async-meth-static-dflt-params-ref-prior.js index 2e2126f89a5ae53ca00816b8629fb9dc0b1ae2e8..dedfe2b490b023954aaa2c20ba6f5edd2014addc 100644 --- a/test/language/statements/class/async-meth-static-dflt-params-ref-prior.js +++ b/test/language/statements/class/async-meth-static-dflt-params-ref-prior.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter that occurs earlier in the ParameterList (static class declaration async method) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-static-dflt-params-ref-self.js b/test/language/statements/class/async-meth-static-dflt-params-ref-self.js index 716f786d4704f3e79376e7bf75cff4f2a965f926..b012e2b5f205d6dc8eb1e0289bf1483e7b292da7 100644 --- a/test/language/statements/class/async-meth-static-dflt-params-ref-self.js +++ b/test/language/statements/class/async-meth-static-dflt-params-ref-self.js @@ -4,7 +4,7 @@ /*--- description: Referencing a parameter from within its own initializer (static class declaration async method) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [default-parameters] +features: [default-parameters, async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-static-dflt-params-trailing-comma.js b/test/language/statements/class/async-meth-static-dflt-params-trailing-comma.js index e9a769b125fe222c607151c14d141862c111d8f1..76f4dbf7e34356b69ba4a23946b04672052db9c4 100644 --- a/test/language/statements/class/async-meth-static-dflt-params-trailing-comma.js +++ b/test/language/statements/class/async-meth-static-dflt-params-trailing-comma.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using default parameters (static class declaration async method) esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-static-params-trailing-comma-multiple.js b/test/language/statements/class/async-meth-static-params-trailing-comma-multiple.js index 7c0bebd53884be4ba4a10691f17a33bb970afc03..d0e37cf8ef97f7eb155e5b6539e7e5d063b05462 100644 --- a/test/language/statements/class/async-meth-static-params-trailing-comma-multiple.js +++ b/test/language/statements/class/async-meth-static-params-trailing-comma-multiple.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using multiple parameters (static class declaration async method) esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/async-meth-static-params-trailing-comma-single.js b/test/language/statements/class/async-meth-static-params-trailing-comma-single.js index ef5179ae286115130b554172d4b005a8a8b4c9e8..922c9983c8d339a0e63d4a01be75fdcfc8bf4bc7 100644 --- a/test/language/statements/class/async-meth-static-params-trailing-comma-single.js +++ b/test/language/statements/class/async-meth-static-params-trailing-comma-single.js @@ -4,6 +4,7 @@ /*--- description: A trailing comma should not increase the respective length, using a single parameter (static class declaration async method) esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [async-functions] flags: [generated, async] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/definition/class-method-returns-promise.js b/test/language/statements/class/definition/class-method-returns-promise.js index a0bc6064e783514865c1b961a9b3742320495f19..cb065d66052cec8db1b1f908da29320f25194d01 100644 --- a/test/language/statements/class/definition/class-method-returns-promise.js +++ b/test/language/statements/class/definition/class-method-returns-promise.js @@ -4,6 +4,7 @@ /*--- author: Brian Terlson <brian.terlson@microsoft.com> esid: pending +features: [async-functions] description: > Async function expressions return promises ---*/ diff --git a/test/language/statements/class/definition/methods-async-super-call-body.js b/test/language/statements/class/definition/methods-async-super-call-body.js index 5999137619dbc283765c817db761ab55bfdec9ee..cf69be1fd2f21581f94a458e30a7b5b629009f9b 100644 --- a/test/language/statements/class/definition/methods-async-super-call-body.js +++ b/test/language/statements/class/definition/methods-async-super-call-body.js @@ -7,6 +7,7 @@ esid: pending description: > Super calls work in body of async methods flags: [async] +features: [async-functions] ---*/ class A { async method() { diff --git a/test/language/statements/class/definition/methods-async-super-call-param.js b/test/language/statements/class/definition/methods-async-super-call-param.js index 4375b932f907b23b2f22739d201559be62faaf05..efb81ba1bb9c9727a9f263413341c56735888568 100644 --- a/test/language/statements/class/definition/methods-async-super-call-param.js +++ b/test/language/statements/class/definition/methods-async-super-call-param.js @@ -7,6 +7,7 @@ esid: pending description: > Super calls work in the parameter list of async methods flags: [async] +features: [async-functions] ---*/ class A { diff --git a/test/language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-close.js b/test/language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-close.js index 75f63df8143e5239310f1003ae6207b1822960e8..c871115c5b2914e4bf9089a8f767282aa8b88a03 100644 --- a/test/language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-close.js +++ b/test/language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-close.js @@ -4,8 +4,7 @@ /*--- description: Iterator is closed when not exhausted by pattern evaluation (private class expression method (default parameters)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close.js b/test/language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close.js index c47eefa2f7cc54a1b8e220d497f23b4d5c57be87..383080f63aa8d0a7b72be20b57ddb1ed7363f798 100644 --- a/test/language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close.js +++ b/test/language/statements/class/dstr-private-gen-meth-dflt-ary-init-iter-no-close.js @@ -4,8 +4,7 @@ /*--- description: Iterator is not closed when exhausted by pattern evaluation (private class expression method (default parameters)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/test/language/statements/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js index 8981007f2b4573a2d7b1b642128f8a48438eeb53..02f8d0e81af6babc3d32232c09ad5dc8aebed1d8 100644 --- a/test/language/statements/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js +++ b/test/language/statements/class/dstr-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -4,8 +4,7 @@ /*--- description: RestElement applied to an exhausted iterator (private class expression method (default parameters)) esid: sec-class-definitions-runtime-semantics-evaluation -features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close.js b/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close.js index 364252508c488a952b4dd3c64758d3f869601cb5..58ba379ee7dc12143bb2c3457610715f209f83b7 100644 --- a/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close.js +++ b/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-close.js @@ -4,8 +4,7 @@ /*--- description: Iterator is closed when not exhausted by pattern evaluation (private static class expression generator method (default parameter)) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close.js b/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close.js index 9ce116184042da4addd4693be74ec1396af7d0fe..7487cbd61ffb3fd82d71e79ac011c2063391eb65 100644 --- a/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close.js +++ b/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-init-iter-no-close.js @@ -4,8 +4,7 @@ /*--- description: Iterator is not closed when exhausted by pattern evaluation (private static class expression generator method (default parameter)) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js index 658375969176c931e86e8459bdfda7bcfe2f39f4..98c641707766937bd954112203a1ca1b3ee2dcb0 100644 --- a/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js +++ b/test/language/statements/class/dstr-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js @@ -4,8 +4,7 @@ /*--- description: RestElement applied to an exhausted iterator (private static class expression generator method (default parameter)) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] info: | ClassDeclaration : class BindingIdentifier ClassTail diff --git a/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js b/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js index 19ba3d2741e1967b27a0b624e24de098293e604d..b239cd0651ed0bbf72d02d5fbe3f5eee5169daf2 100644 --- a/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js +++ b/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js @@ -4,8 +4,7 @@ /*--- description: Getter is called when obj is being deconstructed to a rest Object (private static class expression generator method (default parameter)) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js index 6f60b67a3c27ae7126fdf75f73401b1609dc7760..f670c7213cec14e99cd10b77452378738e5932a9 100644 --- a/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js +++ b/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -4,8 +4,7 @@ /*--- description: Rest object doesn't contain non-enumerable properties (private static class expression generator method (default parameter)) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js index 20e968efc0f9ca7de4b0dd6ffe989118fca96a85..24e39868be66b5054bf5ae4b6a94291965b2104c 100644 --- a/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js +++ b/test/language/statements/class/dstr-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js @@ -4,8 +4,7 @@ /*--- description: Rest object contains just unextracted data (private static class expression generator method (default parameter)) esid: sec-runtime-semantics-bindingclassdeclarationevaluation -features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, - default-parameters] +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js index 8ed2d5869f28bba5e6fc5f23dbb7f17880c8927c..023120c3d977d6ac32d72b1a0c3d02c8f5ab8706 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions after a static async generator in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - async-iteration] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-iteration] flags: [generated, async] includes: [propertyHelper.js] info: | diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js b/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js index 711a068e8a28da2d531314c3070a570d03f2cc32..871107c325be2a26f23a6945f123e6a156d65cb6 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions after a static async method in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - async-functions] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-functions] flags: [generated, async] includes: [propertyHelper.js] info: | diff --git a/test/language/statements/class/fields-new-sc-line-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-new-sc-line-gen-static-private-methods-with-fields.js index fd777b95f5aa87fee49b68e57cca04184fc1509b..0ea5bd0cd45c3d583b21b913bfaf9c4e1e0a41e9 100644 --- a/test/language/statements/class/fields-new-sc-line-gen-static-private-methods-with-fields.js +++ b/test/language/statements/class/fields-new-sc-line-gen-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions followed by a method in a new line with a semicolon) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - generators] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, generators] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/statements/class/fields-same-line-async-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-same-line-async-gen-static-private-methods-with-fields.js index 1358b4115faca3fd6e3a0b46961a108210b75f75..26ccf1cb2b4bbb2965642667c7b65cb7e5796451 100644 --- a/test/language/statements/class/fields-same-line-async-gen-static-private-methods-with-fields.js +++ b/test/language/statements/class/fields-same-line-async-gen-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions after an async generator in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - async-iteration] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-iteration] flags: [generated, async] includes: [propertyHelper.js] info: | diff --git a/test/language/statements/class/fields-same-line-async-method-static-private-methods-with-fields.js b/test/language/statements/class/fields-same-line-async-method-static-private-methods-with-fields.js index 01ea98d7c8619fd02037357575c7541379d7cc90..92b84a900363a9b61e52be872381670d86ff1747 100644 --- a/test/language/statements/class/fields-same-line-async-method-static-private-methods-with-fields.js +++ b/test/language/statements/class/fields-same-line-async-method-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions after an async method in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - async-functions] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-functions] flags: [generated, async] includes: [propertyHelper.js] info: | diff --git a/test/language/statements/class/fields-same-line-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-same-line-gen-static-private-methods-with-fields.js index 2f9877b1f93c9f987494e544ec0ed1f612d331f0..e9fb853c21bd5598a0121daea0378989304044af 100644 --- a/test/language/statements/class/fields-same-line-gen-static-private-methods-with-fields.js +++ b/test/language/statements/class/fields-same-line-gen-static-private-methods-with-fields.js @@ -4,8 +4,7 @@ /*--- description: static private methods with fields (field definitions followed by a generator method in the same line) esid: prod-FieldDefinition -features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, - generators] +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, generators] flags: [generated] includes: [propertyHelper.js] info: | diff --git a/test/language/statements/class/gen-method-yield-identifier-spread-strict.js b/test/language/statements/class/gen-method-yield-identifier-spread-strict.js index 594be88f44aff7364155d57d66bb61d81557b286..3e136b5622fc72c1b3b7c94f12275efa97c94aaa 100644 --- a/test/language/statements/class/gen-method-yield-identifier-spread-strict.js +++ b/test/language/statements/class/gen-method-yield-identifier-spread-strict.js @@ -1,17 +1,17 @@ // This file was procedurally generated from the following sources: // - src/generators/yield-identifier-spread-strict.case -// - src/generators/default/class-decl-private-method.template +// - src/generators/default/class-decl-method.template /*--- -description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator private method as a ClassDeclaration element) -esid: prod-GeneratorPrivateMethod -features: [object-spread, generators, class-methods-private] +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator method as a ClassDeclaration element) +esid: prod-GeneratorMethod +features: [object-spread, generators] flags: [generated, onlyStrict] negative: phase: parse type: SyntaxError info: | ClassElement : - PrivateMethodDefinition + MethodDefinition MethodDefinition : GeneratorMethod @@ -33,33 +33,20 @@ throw "Test262: This statement should not be evaluated."; var callCount = 0; -class C { - *#gen() { - callCount += 1; - return { - ...(function() { - var yield; - throw new Test262Error(); - }()), - } - } - get gen() { return this.#gen; } -} +class C { *gen() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } +}} -const c = new C(); +var gen = C.prototype.gen; -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); - -var iter = c.gen(); +var iter = gen(); assert.sameValue(callCount, 1); - -// Test the private fields do not appear as properties after set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/test/language/statements/class/gen-method-yield-identifier-strict.js b/test/language/statements/class/gen-method-yield-identifier-strict.js index 95ab5b41491713b006454291e1358f2afdc507b0..ff6e459b95fa6c45403d0836febf004fbf4c17a5 100644 --- a/test/language/statements/class/gen-method-yield-identifier-strict.js +++ b/test/language/statements/class/gen-method-yield-identifier-strict.js @@ -1,17 +1,17 @@ // This file was procedurally generated from the following sources: // - src/generators/yield-identifier-strict.case -// - src/generators/default/class-decl-private-method.template +// - src/generators/default/class-decl-method.template /*--- -description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator private method as a ClassDeclaration element) -esid: prod-GeneratorPrivateMethod -features: [generators, class-methods-private] +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator method as a ClassDeclaration element) +esid: prod-GeneratorMethod +features: [generators] flags: [generated, onlyStrict] negative: phase: parse type: SyntaxError info: | ClassElement : - PrivateMethodDefinition + MethodDefinition MethodDefinition : GeneratorMethod @@ -26,31 +26,18 @@ throw "Test262: This statement should not be evaluated."; var callCount = 0; -class C { - *#gen() { - callCount += 1; - (function() { - var yield; - throw new Test262Error(); - }()) - } - get gen() { return this.#gen; } -} +class C { *gen() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) +}} -const c = new C(); +var gen = C.prototype.gen; -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); - -var iter = c.gen(); +var iter = gen(); assert.sameValue(callCount, 1); - -// Test the private fields do not appear as properties after set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/test/language/statements/class/gen-method-yield-spread-arr-multiple.js b/test/language/statements/class/gen-method-yield-spread-arr-multiple.js index 1725a9b35c7f4a96d714d20958a3568410737397..0c3374740336fd46b91bd838c6ad9926afec122d 100644 --- a/test/language/statements/class/gen-method-yield-spread-arr-multiple.js +++ b/test/language/statements/class/gen-method-yield-spread-arr-multiple.js @@ -1,15 +1,15 @@ // This file was procedurally generated from the following sources: // - src/generators/yield-spread-arr-multiple.case -// - src/generators/default/class-decl-private-method.template +// - src/generators/default/class-decl-method.template /*--- -description: Use yield value in a array spread position (Generator private method as a ClassDeclaration element) -esid: prod-GeneratorPrivateMethod -features: [generators, class-methods-private] +description: Use yield value in a array spread position (Generator method as a ClassDeclaration element) +esid: prod-GeneratorMethod +features: [generators] flags: [generated] includes: [compareArray.js] info: | ClassElement : - PrivateMethodDefinition + MethodDefinition MethodDefinition : GeneratorMethod @@ -31,22 +31,14 @@ var item; var callCount = 0; -class C { - *#gen() { - callCount += 1; - yield [...yield yield]; - } - get gen() { return this.#gen; } -} +class C { *gen() { + callCount += 1; + yield [...yield yield]; +}} -const c = new C(); +var gen = C.prototype.gen; -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); - -var iter = c.gen(); +var iter = gen(); iter.next(false); item = iter.next(['a', 'b', 'c']); @@ -56,8 +48,3 @@ assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); - -// Test the private fields do not appear as properties after set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/test/language/statements/class/gen-method-yield-spread-arr-single.js b/test/language/statements/class/gen-method-yield-spread-arr-single.js index c1801eb476f09a5d90c310f060edd3c643814cf4..07dd8dd70759f60785b418e404785d86d3cb80ff 100644 --- a/test/language/statements/class/gen-method-yield-spread-arr-single.js +++ b/test/language/statements/class/gen-method-yield-spread-arr-single.js @@ -1,14 +1,14 @@ // This file was procedurally generated from the following sources: // - src/generators/yield-spread-arr-single.case -// - src/generators/default/class-decl-private-method.template +// - src/generators/default/class-decl-method.template /*--- -description: Use yield value in a array spread position (Generator private method as a ClassDeclaration element) -esid: prod-GeneratorPrivateMethod -features: [generators, class-methods-private] +description: Use yield value in a array spread position (Generator method as a ClassDeclaration element) +esid: prod-GeneratorMethod +features: [generators] flags: [generated] info: | ClassElement : - PrivateMethodDefinition + MethodDefinition MethodDefinition : GeneratorMethod @@ -28,22 +28,14 @@ var arr = ['a', 'b', 'c']; var callCount = 0; -class C { - *#gen() { - callCount += 1; - yield [...yield]; - } - get gen() { return this.#gen; } -} +class C { *gen() { + callCount += 1; + yield [...yield]; +}} -const c = new C(); +var gen = C.prototype.gen; -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); - -var iter = c.gen(); +var iter = gen(); iter.next(false); var item = iter.next(arr); @@ -58,8 +50,3 @@ assert.sameValue(value[2], 'c'); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); - -// Test the private fields do not appear as properties after set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/test/language/statements/class/gen-method-yield-spread-obj.js b/test/language/statements/class/gen-method-yield-spread-obj.js index 93e1824cebbcba3f723343b42f96f291cbf6554e..39700e699f3ba3eaea9b382510578b4fc6303de5 100644 --- a/test/language/statements/class/gen-method-yield-spread-obj.js +++ b/test/language/statements/class/gen-method-yield-spread-obj.js @@ -1,15 +1,15 @@ // This file was procedurally generated from the following sources: // - src/generators/yield-spread-obj.case -// - src/generators/default/class-decl-private-method.template +// - src/generators/default/class-decl-method.template /*--- -description: Use yield value in a object spread position (Generator private method as a ClassDeclaration element) -esid: prod-GeneratorPrivateMethod -features: [object-spread, generators, class-methods-private] +description: Use yield value in a object spread position (Generator method as a ClassDeclaration element) +esid: prod-GeneratorMethod +features: [object-spread, generators] flags: [generated] includes: [compareArray.js] info: | ClassElement : - PrivateMethodDefinition + MethodDefinition MethodDefinition : GeneratorMethod @@ -30,26 +30,18 @@ info: | var callCount = 0; -class C { - *#gen() { - callCount += 1; - yield { - ...yield, - y: 1, - ...yield yield, - }; - } - get gen() { return this.#gen; } -} +class C { *gen() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; +}} -const c = new C(); +var gen = C.prototype.gen; -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); - -var iter = c.gen(); +var iter = gen(); iter.next(); iter.next({ x: 42 }); @@ -62,8 +54,3 @@ assert.sameValue(Object.keys(item.value).length, 2); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); - -// Test the private fields do not appear as properties after set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); -assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/test/language/statements/class/gen-private-method-yield-identifier-spread-strict.js b/test/language/statements/class/gen-private-method-yield-identifier-spread-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..594be88f44aff7364155d57d66bb61d81557b286 --- /dev/null +++ b/test/language/statements/class/gen-private-method-yield-identifier-spread-strict.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-strict.case +// - src/generators/default/class-decl-private-method.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator private method as a ClassDeclaration element) +esid: prod-GeneratorPrivateMethod +features: [object-spread, generators, class-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +throw "Test262: This statement should not be evaluated."; + +var callCount = 0; + +class C { + *#gen() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/test/language/statements/class/gen-private-method-yield-identifier-strict.js b/test/language/statements/class/gen-private-method-yield-identifier-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..95ab5b41491713b006454291e1358f2afdc507b0 --- /dev/null +++ b/test/language/statements/class/gen-private-method-yield-identifier-strict.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-strict.case +// - src/generators/default/class-decl-private-method.template +/*--- +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator private method as a ClassDeclaration element) +esid: prod-GeneratorPrivateMethod +features: [generators, class-methods-private] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + +---*/ +throw "Test262: This statement should not be evaluated."; + +var callCount = 0; + +class C { + *#gen() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/test/language/statements/class/gen-private-method-yield-spread-arr-multiple.js b/test/language/statements/class/gen-private-method-yield-spread-arr-multiple.js new file mode 100644 index 0000000000000000000000000000000000000000..1725a9b35c7f4a96d714d20958a3568410737397 --- /dev/null +++ b/test/language/statements/class/gen-private-method-yield-spread-arr-multiple.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-multiple.case +// - src/generators/default/class-decl-private-method.template +/*--- +description: Use yield value in a array spread position (Generator private method as a ClassDeclaration element) +esid: prod-GeneratorPrivateMethod +features: [generators, class-methods-private] +flags: [generated] +includes: [compareArray.js] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + +var callCount = 0; + +class C { + *#gen() { + callCount += 1; + yield [...yield yield]; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next(false); +item = iter.next(['a', 'b', 'c']); +item = iter.next(item.value); + +assert(compareArray(item.value, arr)); +assert.sameValue(item.done, false); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/test/language/statements/class/gen-private-method-yield-spread-arr-single.js b/test/language/statements/class/gen-private-method-yield-spread-arr-single.js new file mode 100644 index 0000000000000000000000000000000000000000..c1801eb476f09a5d90c310f060edd3c643814cf4 --- /dev/null +++ b/test/language/statements/class/gen-private-method-yield-spread-arr-single.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-single.case +// - src/generators/default/class-decl-private-method.template +/*--- +description: Use yield value in a array spread position (Generator private method as a ClassDeclaration element) +esid: prod-GeneratorPrivateMethod +features: [generators, class-methods-private] +flags: [generated] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] +---*/ +var arr = ['a', 'b', 'c']; + +var callCount = 0; + +class C { + *#gen() { + callCount += 1; + yield [...yield]; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next(false); +var item = iter.next(arr); +var value = item.value; + +assert.notSameValue(value, arr, 'value is a new array'); +assert(Array.isArray(value), 'value is an Array exotic object'); +assert.sameValue(value.length, 3) +assert.sameValue(value[0], 'a'); +assert.sameValue(value[1], 'b'); +assert.sameValue(value[2], 'c'); +assert.sameValue(item.done, false); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/test/language/statements/class/gen-private-method-yield-spread-obj.js b/test/language/statements/class/gen-private-method-yield-spread-obj.js new file mode 100644 index 0000000000000000000000000000000000000000..93e1824cebbcba3f723343b42f96f291cbf6554e --- /dev/null +++ b/test/language/statements/class/gen-private-method-yield-spread-obj.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-obj.case +// - src/generators/default/class-decl-private-method.template +/*--- +description: Use yield value in a object spread position (Generator private method as a ClassDeclaration element) +esid: prod-GeneratorPrivateMethod +features: [object-spread, generators, class-methods-private] +flags: [generated] +includes: [compareArray.js] +info: | + ClassElement : + PrivateMethodDefinition + + MethodDefinition : + GeneratorMethod + + 14.4 Generator Function Definitions + + GeneratorMethod : + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + +var callCount = 0; + +class C { + *#gen() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; + } + get gen() { return this.#gen; } +} + +const c = new C(); + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); + +var iter = c.gen(); + +iter.next(); +iter.next({ x: 42 }); +iter.next({ x: 'lol' }); +var item = iter.next({ y: 39 }); + +assert.sameValue(item.value.x, 42); +assert.sameValue(item.value.y, 39); +assert.sameValue(Object.keys(item.value).length, 2); +assert.sameValue(item.done, false); + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#gen"), false, 'Object.hasOwnProperty.call(C.prototype, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(C, "#gen"), false, 'Object.hasOwnProperty.call(C, "#gen")'); +assert.sameValue(Object.hasOwnProperty.call(c, "#gen"), false, 'Object.hasOwnProperty.call(c, "#gen")'); diff --git a/tools/generation/lib/template.py b/tools/generation/lib/template.py index bc66b7e8cb783e5a68aa329fddc58540425b6737..d5fc78d8462a4eb6f9544fc3e879b0adf6dd6c7c 100644 --- a/tools/generation/lib/template.py +++ b/tools/generation/lib/template.py @@ -154,7 +154,7 @@ class Template: features += self.attribs['meta'].get('features', []) features = list(OrderedDict.fromkeys(features)) if len(features): - lines += ['features: ' + yaml.dump(features).strip()] + lines += ['features: ' + re.sub('\n\s*', ' ', yaml.dump(features).strip())] flags = ['generated'] flags += case_values['meta'].get('flags', [])