-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into import-attributes-3
- Loading branch information
Showing
495 changed files
with
7,153 additions
and
3,760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test/annexB/language/eval-code/direct/script-decl-lex-collision-in-sloppy-mode.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2023 Alexey Shvayka. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-globaldeclarationinstantiation | ||
description: Let binding collision with existing var declaration that was created for hoisted function. | ||
info: | | ||
[...] | ||
3. For each element name of lexNames, do | ||
a. If env.HasVarDeclaration(name) is true, throw a SyntaxError exception. | ||
flags: [noStrict] | ||
---*/ | ||
|
||
eval('if (true) { function test262Fn() {} }'); | ||
|
||
assert.throws(SyntaxError, function() { | ||
$262.evalScript('var x; let test262Fn;'); | ||
}); | ||
|
||
assert.throws(ReferenceError, function() { | ||
x; | ||
}, 'no bindings created'); |
21 changes: 21 additions & 0 deletions
21
test/annexB/language/eval-code/direct/script-decl-lex-no-collision-in-strict-mode.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2023 Alexey Shvayka. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-globaldeclarationinstantiation | ||
description: No let binding collision with existing var declaration due to strict-mode eval(). | ||
info: | | ||
PerformEval ( x, strictCaller, direct ) | ||
[...] | ||
16. If direct is true, then | ||
a. Let lexEnv be NewDeclarativeEnvironment(runningContext's LexicalEnvironment). | ||
[...] | ||
18. If strictEval is true, set varEnv to lexEnv. | ||
flags: [onlyStrict] | ||
---*/ | ||
|
||
eval('if (true) { function test262Fn() {} }'); | ||
|
||
$262.evalScript('let test262Fn = 1;'); | ||
|
||
assert.sameValue(test262Fn, 1); |
23 changes: 23 additions & 0 deletions
23
test/annexB/language/global-code/script-decl-lex-collision.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (C) 2023 Alexey Shvayka. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-globaldeclarationinstantiation | ||
description: Let binding collision with existing var declaration that was created for hoisted function. | ||
info: | | ||
[...] | ||
3. For each element name of lexNames, do | ||
a. If env.HasVarDeclaration(name) is true, throw a SyntaxError exception. | ||
flags: [noStrict] | ||
---*/ | ||
|
||
if (true) { | ||
function test262Fn() {} | ||
} | ||
|
||
assert.throws(SyntaxError, function() { | ||
$262.evalScript('var x; let test262Fn;'); | ||
}); | ||
|
||
assert.throws(ReferenceError, function() { | ||
x; | ||
}, 'no bindings created'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
test/built-ins/Object/prototype/toString/symbol-tag-array-builtin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (C) 2019 Alexey Shvayka. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-object.prototype.tostring | ||
description: > | ||
Non-string values of `Symbol.toStringTag` property are ignored. | ||
info: | | ||
Object.prototype.toString ( ) | ||
[...] | ||
15. Let tag be ? Get(O, @@toStringTag). | ||
16. If Type(tag) is not String, set tag to builtinTag. | ||
17. Return the string-concatenation of "[object ", tag, and "]". | ||
features: [Symbol.toStringTag, Symbol.iterator, iterator-helpers] | ||
---*/ | ||
|
||
var toString = Object.prototype.toString; | ||
|
||
var arrIter = [][Symbol.iterator](); | ||
var arrIterProto = Object.getPrototypeOf(arrIter); | ||
|
||
assert.sameValue(toString.call(arrIter), '[object Array Iterator]'); | ||
|
||
Object.defineProperty(arrIterProto, Symbol.toStringTag, {configurable: true, value: null}); | ||
assert.sameValue(toString.call(arrIter), '[object Object]'); | ||
|
||
delete arrIterProto[Symbol.toStringTag]; | ||
assert.sameValue(toString.call(arrIter), '[object Iterator]'); |
33 changes: 33 additions & 0 deletions
33
test/built-ins/Object/prototype/toString/symbol-tag-generators-builtin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) 2019 Alexey Shvayka. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-object.prototype.tostring | ||
description: > | ||
Non-string values of `Symbol.toStringTag` property are ignored. | ||
info: | | ||
Object.prototype.toString ( ) | ||
[...] | ||
15. Let tag be ? Get(O, @@toStringTag). | ||
16. If Type(tag) is not String, set tag to builtinTag. | ||
17. Return the string-concatenation of "[object ", tag, and "]". | ||
features: [Symbol.toStringTag, Symbol.iterator, generators, iterator-helpers] | ||
---*/ | ||
|
||
var toString = Object.prototype.toString; | ||
|
||
var genFn = function* () {}; | ||
assert.sameValue(toString.call(gen), '[object GeneratorFunction]'); | ||
|
||
var gen = genFn(); | ||
assert.sameValue(toString.call(gen), '[object Generator]'); | ||
|
||
var genProto = Object.getPrototypeOf(gen); | ||
Object.defineProperty(genProto, Symbol.toStringTag, { | ||
configurable: true, | ||
get: function() { return {}; }, | ||
}); | ||
assert.sameValue(toString.call(gen), '[object Object]'); | ||
|
||
delete genProto[Symbol.toStringTag]; | ||
assert.sameValue(toString.call(gen), '[object Iterator]'); |
33 changes: 33 additions & 0 deletions
33
test/built-ins/Object/prototype/toString/symbol-tag-map-builtin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) 2019 Alexey Shvayka. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-object.prototype.tostring | ||
description: > | ||
Non-string values of `Symbol.toStringTag` property are ignored. | ||
info: | | ||
Object.prototype.toString ( ) | ||
[...] | ||
15. Let tag be ? Get(O, @@toStringTag). | ||
16. If Type(tag) is not String, set tag to builtinTag. | ||
17. Return the string-concatenation of "[object ", tag, and "]". | ||
features: [Symbol.toStringTag, Symbol.iterator, Map, iterator-helpers] | ||
---*/ | ||
|
||
var toString = Object.prototype.toString; | ||
|
||
var map = new Map(); | ||
delete Map.prototype[Symbol.toStringTag]; | ||
assert.sameValue(toString.call(map), '[object Object]'); | ||
|
||
var mapIter = map[Symbol.iterator](); | ||
var mapIterProto = Object.getPrototypeOf(mapIter); | ||
assert.sameValue(toString.call(mapIter), '[object Map Iterator]'); | ||
Object.defineProperty(mapIterProto, Symbol.toStringTag, { | ||
configurable: true, | ||
get: function() { return new String('ShouldNotBeUnwrapped'); }, | ||
}); | ||
assert.sameValue(toString.call(mapIter), '[object Object]'); | ||
|
||
delete mapIterProto[Symbol.toStringTag]; | ||
assert.sameValue(toString.call(mapIter), '[object Iterator]'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
test/built-ins/Object/prototype/toString/symbol-tag-promise-builtin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (C) 2019 Alexey Shvayka. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-object.prototype.tostring | ||
description: > | ||
Non-string values of `Symbol.toStringTag` property are ignored. | ||
info: | | ||
Object.prototype.toString ( ) | ||
[...] | ||
15. Let tag be ? Get(O, @@toStringTag). | ||
16. If Type(tag) is not String, set tag to builtinTag. | ||
17. Return the string-concatenation of "[object ", tag, and "]". | ||
features: [Symbol.toStringTag, Promise] | ||
---*/ | ||
|
||
var toString = Object.prototype.toString; | ||
|
||
var promise = new Promise(function () {}); | ||
assert.sameValue(toString.call(promise), '[object Promise]'); | ||
|
||
delete Promise.prototype[Symbol.toStringTag]; | ||
assert.sameValue(toString.call(promise), '[object Object]'); |
Oops, something went wrong.