diff options
Diffstat (limited to 'js/src/tests/test262/language/eval-code')
353 files changed, 8044 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/eval-code/browser.js b/js/src/tests/test262/language/eval-code/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/browser.js diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-following-parameter-is-named-arguments-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-following-parameter-is-named-arguments-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js new file mode 100644 index 0000000000..18cac1b832 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-following-parameter-is-named-arguments-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js @@ -0,0 +1,15 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.case +// - src/direct-eval-code/arrow-func/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +const f = (p = eval("var arguments = 'param'"), q = () => arguments, arguments) => {} +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-following-parameter-is-named-arguments-arrow-func-declare-arguments-assign.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-following-parameter-is-named-arguments-arrow-func-declare-arguments-assign.js new file mode 100644 index 0000000000..20e0238073 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-following-parameter-is-named-arguments-arrow-func-declare-arguments-assign.js @@ -0,0 +1,15 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign.case +// - src/direct-eval-code/arrow-func/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +const f = (p = eval("var arguments = 'param'"), arguments) => {} +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-preceding-parameter-is-named-arguments-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-preceding-parameter-is-named-arguments-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js new file mode 100644 index 0000000000..510bbae839 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-preceding-parameter-is-named-arguments-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js @@ -0,0 +1,15 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.case +// - src/direct-eval-code/arrow-func/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +const f = (arguments, p = eval("var arguments = 'param'"), q = () => arguments) => {} +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-preceding-parameter-is-named-arguments-arrow-func-declare-arguments-assign.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-preceding-parameter-is-named-arguments-arrow-func-declare-arguments-assign.js new file mode 100644 index 0000000000..6a65af57d7 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-a-preceding-parameter-is-named-arguments-arrow-func-declare-arguments-assign.js @@ -0,0 +1,15 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign.case +// - src/direct-eval-code/arrow-func/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +const f = (arguments, p = eval("var arguments = 'param'")) => {} +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-func-decl-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-func-decl-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js new file mode 100644 index 0000000000..fc169f3348 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-func-decl-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js @@ -0,0 +1,22 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.case +// - src/direct-eval-code/arrow-func/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let count = 0; +const f = (p = eval("var arguments = 'param'"), q = () => arguments) => { + function arguments() {} + assert.sameValue(typeof arguments, "function"); + assert.sameValue(q(), "param"); + count++; +} +f(); +assert.sameValue(count, 1); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-func-decl-arrow-func-declare-arguments-assign.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-func-decl-arrow-func-declare-arguments-assign.js new file mode 100644 index 0000000000..4d4ac406dc --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-func-decl-arrow-func-declare-arguments-assign.js @@ -0,0 +1,22 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign.case +// - src/direct-eval-code/arrow-func/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let count = 0; +const f = (p = eval("var arguments = 'param'")) => { + function arguments() {} + assert.sameValue(typeof arguments, "function"); + + count++; +} +f(); +assert.sameValue(count, 1); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-lex-bind-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-lex-bind-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js new file mode 100644 index 0000000000..d3c7d3824c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-lex-bind-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js @@ -0,0 +1,22 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.case +// - src/direct-eval-code/arrow-func/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let count = 0; +const f = (p = eval("var arguments = 'param'"), q = () => arguments) => { + let arguments = "local"; + assert.sameValue(arguments, "local"); + assert.sameValue(q(), "param"); + count++; +} +f(); +assert.sameValue(count, 1); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-lex-bind-arrow-func-declare-arguments-assign.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-lex-bind-arrow-func-declare-arguments-assign.js new file mode 100644 index 0000000000..c07577fe93 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-lex-bind-arrow-func-declare-arguments-assign.js @@ -0,0 +1,22 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign.case +// - src/direct-eval-code/arrow-func/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let count = 0; +const f = (p = eval("var arguments = 'param'")) => { + let arguments = "local"; + assert.sameValue(arguments, "local"); + + count++; +} +f(); +assert.sameValue(count, 1); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-var-bind-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-var-bind-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js new file mode 100644 index 0000000000..9a22f1e3ec --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-var-bind-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js @@ -0,0 +1,22 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.case +// - src/direct-eval-code/arrow-func/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let count = 0; +const f = (p = eval("var arguments = 'param'"), q = () => arguments) => { + var arguments = "local"; + assert.sameValue(arguments, "local"); + assert.sameValue(q(), "param"); + count++; +} +f(); +assert.sameValue(count, 1); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-var-bind-arrow-func-declare-arguments-assign.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-var-bind-arrow-func-declare-arguments-assign.js new file mode 100644 index 0000000000..66b7412d1e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-body-cntns-arguments-var-bind-arrow-func-declare-arguments-assign.js @@ -0,0 +1,22 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign.case +// - src/direct-eval-code/arrow-func/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let count = 0; +const f = (p = eval("var arguments = 'param'")) => { + var arguments = "local"; + assert.sameValue(arguments, "local"); + + count++; +} +f(); +assert.sameValue(count, 1); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-no-pre-existing-arguments-bindings-are-present-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-no-pre-existing-arguments-bindings-are-present-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js new file mode 100644 index 0000000000..560fc6c767 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-no-pre-existing-arguments-bindings-are-present-arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign-incl-def-param-arrow-arguments.case +// - src/direct-eval-code/arrow-func/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let count = 0; +const f = (p = eval("var arguments = 'param'"), q = () => arguments) => { + assert.sameValue(arguments, "param"); + count++; +} +f(); +assert.sameValue(count, 1); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/arrow-fn-no-pre-existing-arguments-bindings-are-present-arrow-func-declare-arguments-assign.js b/js/src/tests/test262/language/eval-code/direct/arrow-fn-no-pre-existing-arguments-bindings-are-present-arrow-func-declare-arguments-assign.js new file mode 100644 index 0000000000..0fe50757ca --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/arrow-fn-no-pre-existing-arguments-bindings-are-present-arrow-func-declare-arguments-assign.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/arrow-func-declare-arguments-assign.case +// - src/direct-eval-code/arrow-func/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let count = 0; +const f = (p = eval("var arguments = 'param'")) => { + assert.sameValue(arguments, "param"); + count++; +} +f(); +assert.sameValue(count, 1); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..ebdb96141e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-decl/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments = 'param'"), arguments) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..86140b5744 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-decl/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments"), arguments) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..267c0c4227 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-decl/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(arguments, p = eval("var arguments = 'param'")) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..79b2c2d4cf --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-decl/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(arguments, p = eval("var arguments")) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..e24b244616 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-decl/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments = 'param'")) { + function arguments() {} +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..076371af06 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-decl/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments")) { + function arguments() {} +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..00d74fc54a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-decl/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments = 'param'")) { + let arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..b1f370d3cd --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-decl/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments")) { + let arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..de88100908 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-decl/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments = 'param'")) { + var arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..fbd5437f9b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-decl/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments")) { + var arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..c47458d35f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,17 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-decl/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments = 'param'")) {} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..97c8f9ee7e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,17 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-decl/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function f(p = eval("var arguments")) {} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..da046fe104 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-named/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments = 'param'"), arguments) { + +}; +f().then($DONE, error => { + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + assert(error instanceof SyntaxError); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..2ea0b1f07f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-named/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments"), arguments) { + +}; +f().then($DONE, error => { + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + assert(error instanceof SyntaxError); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..9a0f09e371 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-named/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(arguments, p = eval("var arguments = 'param'")) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..ce1caff302 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-named/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(arguments, p = eval("var arguments")) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..ef26b13271 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-named/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments = 'param'")) { + function arguments() {} +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..dbd51bb69a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-named/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments")) { + function arguments() {} +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..4945969904 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-named/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments = 'param'")) { + let arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..d0e74e771f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-named/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments")) { + let arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..3f8762b44e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-named/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments = 'param'")) { + var arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..3485f97ee5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-named/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments")) { + var arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..e2ca6adcc4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-named/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments = 'param'")) {} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..442d70371c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,18 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-named/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function f(p = eval("var arguments")) {} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..150ad7e284 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-nameless/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments = 'param'"), arguments) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..7bd36d09da --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-nameless/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments"), arguments) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..7b744fdc0c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-nameless/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(arguments, p = eval("var arguments = 'param'")) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..9688071ffa --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-nameless/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(arguments, p = eval("var arguments")) { + +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..aaf357ebc5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-nameless/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments = 'param'")) { + function arguments() {} +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..d19333ab21 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-nameless/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments")) { + function arguments() {} +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..cfd66d9cc6 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-nameless/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments = 'param'")) { + let arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..6aa24e3aab --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-nameless/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments")) { + let arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..1cce8efb16 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-nameless/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments = 'param'")) { + var arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..9d1f5ceda6 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-nameless/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments")) { + var arguments; +} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..e2d9487e77 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,17 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-func-expr-nameless/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments = 'param'")) {} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..3aa403fd2f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,17 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-func-expr-nameless/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function(p = eval("var arguments")) {} +f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..bfdb037b9d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-decl/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments = 'param'"), arguments) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..680becf3c2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-decl/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments"), arguments) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..4e5f569041 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-decl/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(arguments, p = eval("var arguments = 'param'")) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..58b316be45 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-decl/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(arguments, p = eval("var arguments")) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..c0711eb257 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-decl/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments = 'param'")) { + function arguments() {} +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..0585d9f02c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-decl/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments")) { + function arguments() {} +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..4281eaba2e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-decl/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments = 'param'")) { + let arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..402f09d801 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-decl/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments")) { + let arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..79d44b4eed --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-decl/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments = 'param'")) { + var arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..4a32999dfa --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-decl/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments")) { + var arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..b399ed4c1e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-decl/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments = 'param'")) {} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..1b4f252558 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-decl/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +async function * f(p = eval("var arguments")) {} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..38f6aefc24 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-expr/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments = 'param'"), arguments) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..983f3893ec --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-expr/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments"), arguments) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..ca6838aa18 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-expr/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (arguments, p = eval("var arguments = 'param'")) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..eaf45bdc15 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-expr/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (arguments, p = eval("var arguments")) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..c8a6d33543 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-expr/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments = 'param'")) { + function arguments() {} +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..bd922d2992 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-expr/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments")) { + function arguments() {} +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..b2eaee6937 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-expr/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments = 'param'")) { + let arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..33022ae08c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-expr/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments")) { + let arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..c3ab6ff525 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-expr/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments = 'param'")) { + var arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..270b905e89 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-expr/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments")) { + var arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..4a8119b5b5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-func-expr/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments = 'param'")) {} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..340042aec2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-func-expr/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * (p = eval("var arguments")) {} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..a4889a8ece --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-meth/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments = 'param'"), arguments) { + +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..81ac218c56 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-meth/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments"), arguments) { + +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..bbf6242d05 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-meth/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(arguments, p = eval("var arguments = 'param'")) { + +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..a129d8dbb2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-meth/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(arguments, p = eval("var arguments")) { + +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..f49c699466 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-meth/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments = 'param'")) { + function arguments() {} +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..f75e866c23 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-meth/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments")) { + function arguments() {} +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..d6a0c85059 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-meth/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments = 'param'")) { + let arguments; +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..d9930ee9c1 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-meth/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments")) { + let arguments; +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..4d0bafa281 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-meth/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments = 'param'")) { + var arguments; +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..2bdc6ac925 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-meth/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments")) { + var arguments; +}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..9cdaeff70b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-meth/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments = 'param'")) {}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..0ed89b557d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-meth/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async *f(p = eval("var arguments")) {}}; +assert.throws(SyntaxError, o.f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..c16131035a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-named-func-expr/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments = 'param'"), arguments) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..4f3e39bb94 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-named-func-expr/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments"), arguments) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..23b46f6cef --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-named-func-expr/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(arguments, p = eval("var arguments = 'param'")) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..4733198d02 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-named-func-expr/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(arguments, p = eval("var arguments")) { + +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..ec46b8d438 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-named-func-expr/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments = 'param'")) { + function arguments() {} +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..a6333b6f56 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-named-func-expr/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments")) { + function arguments() {} +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..a392140849 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-named-func-expr/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments = 'param'")) { + let arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..bf21574322 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-named-func-expr/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments")) { + let arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..002e63aeac --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-named-func-expr/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments = 'param'")) { + var arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..4dba30a62f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-named-func-expr/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments")) { + var arguments; +} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..312898acc3 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-gen-named-func-expr/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments = 'param'")) {} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..e79edf1be1 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-gen-named-func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-gen-named-func-expr/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let f = async function * f(p = eval("var arguments")) {} + +assert.throws(SyntaxError, f); +assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..7ec1ef7abf --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-meth/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments = 'param'"), arguments) { + +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-meth-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..ce14f632af --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-meth/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments"), arguments) { + +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..cf0293acfe --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-meth/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(arguments, p = eval("var arguments = 'param'")) { + +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-meth-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..295bd5d89f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-meth/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(arguments, p = eval("var arguments")) { + +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..7189430ce8 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-meth/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments = 'param'")) { + function arguments() {} +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..db24a04303 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-meth/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments")) { + function arguments() {} +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..eabc45ab88 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-meth/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments = 'param'")) { + let arguments; +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..ddc5197fd6 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-meth/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments")) { + let arguments; +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..7939cc91b4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-meth/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments = 'param'")) { + var arguments; +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..cdf907a64d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,19 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-meth/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments")) { + var arguments; +}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/async-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..3517e90ada --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,17 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/async-meth/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments = 'param'")) {}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/async-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/async-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..ea663120a9 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/async-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,17 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/async-meth/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +features: [globalThis] +flags: [generated, async, noStrict] +---*/ + +const oldArguments = globalThis.arguments; +let o = { async f(p = eval("var arguments")) {}}; +o.f().then($DONE, error => { + assert(error instanceof SyntaxError); + assert.sameValue(globalThis.arguments, oldArguments, "globalThis.arguments unchanged"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/eval-code/direct/block-decl-eval-source-is-strict-nostrict.js b/js/src/tests/test262/language/eval-code/direct/block-decl-eval-source-is-strict-nostrict.js new file mode 100644 index 0000000000..f134c2816d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/block-decl-eval-source-is-strict-nostrict.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Block statement + in eval code containing a function declaration +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [noStrict] +---*/ + +var err; + +eval('"use strict";{ function f() {} }'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/block-decl-eval-source-is-strict-onlystrict-strict.js b/js/src/tests/test262/language/eval-code/direct/block-decl-eval-source-is-strict-onlystrict-strict.js new file mode 100644 index 0000000000..45859ee32d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/block-decl-eval-source-is-strict-onlystrict-strict.js @@ -0,0 +1,31 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Block statement + in eval code containing a function declaration +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [onlyStrict] +---*/ + +var err; + +eval('"use strict";{ function f() {} }'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/block-decl-onlystrict-strict.js b/js/src/tests/test262/language/eval-code/direct/block-decl-onlystrict-strict.js new file mode 100644 index 0000000000..9a2bad3a64 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/block-decl-onlystrict-strict.js @@ -0,0 +1,30 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Block statement + in eval code containing a function declaration +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [onlyStrict] +---*/ + +var err; + +eval('{ function f() {} }'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/browser.js b/js/src/tests/test262/language/eval-code/direct/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/browser.js diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-block.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-block.js new file mode 100644 index 0000000000..35fdc4217a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-block.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +es5id: 15.1.2.1_A3.2_T1 +description: Block statement +---*/ + +//CHECK#1 +if (eval("{}") !== undefined) { + throw new Test262Error('#1: eval("{}") === undefined. Actual: ' + (eval("{}"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-do-while.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-do-while.js new file mode 100644 index 0000000000..9b7d6f30b8 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-do-while.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +es5id: 15.1.2.1_A3.2_T6 +description: do-while statement +---*/ + +//CHECK#1 +if (eval("do ; while(false)") !== undefined) { + throw new Test262Error('#1: eval("do ; while(false)") === undefined. Actual: ' + (eval("do ; while(false)"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-empty.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-empty.js new file mode 100644 index 0000000000..9338729f0b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-empty.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +es5id: 15.1.2.1_A3.2_T3 +description: Empty statement +---*/ + +//CHECK#1 +if (eval(";") !== undefined) { + throw new Test262Error('#1: eval(";") === undefined. Actual: ' + (eval(";"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-for.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-for.js new file mode 100644 index 0000000000..5bcf529a80 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-for.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +es5id: 15.1.2.1_A3.2_T8 +description: for statement +---*/ + +//CHECK#1 +if (eval("for(false;false;false);") !== undefined) { + throw new Test262Error('#1: eval("for(false;false;false);") === undefined. Actual: ' + (eval("for(false;false;false);"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-if.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-if.js new file mode 100644 index 0000000000..19c4189173 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-if.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +es5id: 15.1.2.1_A3.2_T4 +description: If statement +---*/ + +//CHECK#1 +if (eval("if (false) ;") !== undefined) { + throw new Test262Error('#1: eval("if (false) ;") === undefined. Actual: ' + eval("if (false) ;")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-switch.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-switch.js new file mode 100644 index 0000000000..bd9ceffc3d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-switch.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +es5id: 15.1.2.1_A3.2_T5 +description: Switch statement +---*/ + +//CHECK#1 +if (eval("switch(1){}") !== undefined) { + throw new Test262Error('#1: eval("switch(1){}") === undefined. Actual: ' + (eval("switch(1){}"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-var.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-var.js new file mode 100644 index 0000000000..05b22256c4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-var.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +es5id: 15.1.2.1_A3.2_T2 +description: Var statement +---*/ + +//CHECK#1 +if (eval("var x = 1") !== undefined) { + throw new Test262Error('#1: eval("var x = 1") === undefined. Actual: ' + (eval("var x = 1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-while.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-while.js new file mode 100644 index 0000000000..76402a491a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-empty-while.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +es5id: 15.1.2.1_A3.2_T7 +description: do-while statement +---*/ + +//CHECK#1 +if (eval("while(false);") !== undefined) { + throw new Test262Error('#1: eval("while(false);") === undefined. Actual: ' + (eval("while(false);"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-expr-obj.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-expr-obj.js new file mode 100644 index 0000000000..e5ee6395e4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-expr-obj.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is a value V, + then return the value V +es5id: 15.1.2.1_A3.1_T2 +description: Expression statement. Eval return object value +---*/ + +//CHECK#1 +var x = {}; +var y; +if (eval("y = x") !== x) { + throw new Test262Error('#1: var x = {}; eval("y = x") === x. Actual: ' + (eval("y = x"))); +} + + +//CHECK#2 +if (eval("x") !== x) { + throw new Test262Error('#2: var x = {}; eval("x") === x. Actual: ' + (eval("x"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-nrml-expr-prim.js b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-expr-prim.js new file mode 100644 index 0000000000..ce8d9477ef --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-nrml-expr-prim.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is normal and its completion value is a value V, + then return the value V +es5id: 15.1.2.1_A3.1_T1 +description: Expression statement. Eval return primitive value +---*/ + +var x; +//CHECK#1 +if (eval("x = 1") !== 1) { + throw new Test262Error('#1: eval("x = 1") === 1. Actual: ' + (eval("x = 1"))); +} + +//CHECK#2 +if (eval("1") !== 1) { + throw new Test262Error('#2: eval("1") === 1. Actual: ' + (eval("1"))); +} + +//CHECK#3 +if (eval("'1'") !== '1') { + throw new Test262Error('#3: eval("\'1\'") === \'1\'. Actual: ' + (eval("'1'"))); +} + +//CHECK#4 +x = 1; +if (eval("++x") !== 2) { + throw new Test262Error('#4: x = 1; eval("++x") === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/cptn-thrw-prim.js b/js/src/tests/test262/language/eval-code/direct/cptn-thrw-prim.js new file mode 100644 index 0000000000..49d29962e4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/cptn-thrw-prim.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is not normal, then Result(3).type must be throw. + Throw Result(3).value as an exception +es5id: 15.1.2.1_A3.3_T4 +description: Throw statement +---*/ + +//CHECK#1 +try { + eval("throw 1;"); + throw new Test262Error('#1.1: throw 1 must throw SyntaxError. Actual: ' + (eval("throw 1;"))); +} catch(e) { + if (e !== 1) { + throw new Test262Error('#1.2: throw 1 must throw SyntaxError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/export.js b/js/src/tests/test262/language/eval-code/direct/export.js new file mode 100644 index 0000000000..93554ff668 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/export.js @@ -0,0 +1,27 @@ +// |reftest| module +// 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 `export` declaration may not appear within eval code +esid: sec-scripts +flags: [module] +info: | + Eval code is the source text supplied to the built-in eval function. More + precisely, if the parameter to the built-in eval function is a String, it + is treated as an ECMAScript Script. The eval code for a particular + invocation of eval is the global code portion of that Script. + + A.5 Scripts and Modules + + Script: + ScriptBodyopt + + ScriptBody: + StatementList +---*/ + +assert.throws(SyntaxError, function() { + eval('export default null;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..9c6e9f77c6 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-decl/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments = 'param'"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-decl-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..425c7f8227 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-decl/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..c7ef417545 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-decl/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(arguments, p = eval("var arguments = 'param'")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..f069685c3c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-decl/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(arguments, p = eval("var arguments")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..e1e215819c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-decl/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments = 'param'")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..98e8489414 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-decl/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..d34371c261 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-decl/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments = 'param'")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..ffcde6d6ca --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-decl/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..23911ccb35 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-decl/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments = 'param'")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..3805fa67c4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-decl/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..0bdad5699c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-decl/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments = 'param'")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..61a61fdcf6 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-decl/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function f(p = eval("var arguments")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-expr-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..a0dbff58c0 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-expr/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments = 'param'"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-expr-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..9c10c55335 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-expr/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-expr-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..0ea91ce9d5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-expr/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(arguments, p = eval("var arguments = 'param'")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-expr-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..da97b8b091 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-expr/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(arguments, p = eval("var arguments")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..e963b9dd36 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-expr/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments = 'param'")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..a4b4c2801a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-expr/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..f44b18e7da --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-expr/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments = 'param'")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..ab36286198 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-expr/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..afe0c12b40 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-expr/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments = 'param'")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..100e000f80 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-expr/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..d598f1bea4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/func-expr/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments = 'param'")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..d4f99d4ade --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/func-expr-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/func-expr/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function(p = eval("var arguments")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..b74433b1ef --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-decl/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments = 'param'"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..09b8c3491f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-decl/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..681cd0d846 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-decl/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(arguments, p = eval("var arguments = 'param'")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..899a58bf45 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-decl/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(arguments, p = eval("var arguments")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..df51957f83 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-decl/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments = 'param'")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..6d00a0fcb3 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-decl/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..d7e7723248 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-decl/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments = 'param'")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..08f1fd6404 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-decl/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..dcd50f6f8a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-decl/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments = 'param'")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..4fecf7e418 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-decl/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..2b09385e8d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-decl/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments = 'param'")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..b44bf09f81 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-decl-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-decl/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +function * f(p = eval("var arguments")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..f7ad408fac --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-named/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments = 'param'"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..53cca3968b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-named/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..cf64177f47 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-named/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(arguments, p = eval("var arguments = 'param'")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..7334227d06 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-named/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(arguments, p = eval("var arguments")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..046f35b837 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-named/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments = 'param'")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..2bf3a04db5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-named/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..ad61377e25 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-named/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments = 'param'")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..9e95316f35 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-named/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..bfada58e94 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-named/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments = 'param'")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..64030a3f42 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-named/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..f868ef2470 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-named/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments = 'param'")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..64551e1be5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-named-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-named/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * f(p = eval("var arguments")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..e23e8ffcbb --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-nameless/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments = 'param'"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..af8888eab5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-nameless/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments"), arguments) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..532159eab5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-nameless/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (arguments, p = eval("var arguments = 'param'")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..cdb0e1ec03 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-nameless/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (arguments, p = eval("var arguments")) { + +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..cdf5bc5035 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-nameless/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments = 'param'")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..b6c57a2a1e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-nameless/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments")) { + function arguments() {} +} +assert.throws(SyntaxError, f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..bfd8c967cd --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-nameless/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments = 'param'")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..7f9bb76386 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-nameless/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments")) { + let arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..5f4386f7d9 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-nameless/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments = 'param'")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..979fc7c107 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-nameless/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments")) { + var arguments; +} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..3410529e16 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-func-expr-nameless/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments = 'param'")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..9b4dea511b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-func-expr-nameless-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-func-expr-nameless/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let f = function * (p = eval("var arguments")) {} +assert.throws(SyntaxError, f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..ef6fc425c4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-meth/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments = 'param'"), arguments) { + +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..700701b437 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-meth/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments"), arguments) { + +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..8258aed324 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-meth/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(arguments, p = eval("var arguments = 'param'")) { + +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..a4a3f8cdf2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-meth/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(arguments, p = eval("var arguments")) { + +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..f267252b49 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-meth/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments = 'param'")) { + function arguments() {} +}}; +assert.throws(SyntaxError, o.f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..fb25cfe85a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-meth/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments")) { + function arguments() {} +}}; +assert.throws(SyntaxError, o.f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..7b3401495e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-meth/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments = 'param'")) { + let arguments; +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..8c81ee5ba5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-meth/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments")) { + let arguments; +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..2e932f2d4b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-meth/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments = 'param'")) { + var arguments; +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..3e067ed668 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-meth/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments")) { + var arguments; +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..a2ba2a52fb --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/gen-meth/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments = 'param'")) {}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..4225ade096 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/gen-meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/gen-meth/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { * f(p = eval("var arguments")) {}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/global-env-rec-catch.js b/js/src/tests/test262/language/eval-code/direct/global-env-rec-catch.js new file mode 100644 index 0000000000..2d7148aec5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/global-env-rec-catch.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-3 +description: > + Direct call to eval has context set to local context (catch block) +---*/ + +var __10_4_2_1_3 = "str"; +function testcase() { + var __10_4_2_1_3 = "str1"; + try { + throw "error"; + } + catch (e) { + var __10_4_2_1_3 = "str2"; + assert(eval("\'str2\' === __10_4_2_1_3"), 'direct eval'); + } + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/global-env-rec-eval.js b/js/src/tests/test262/language/eval-code/direct/global-env-rec-eval.js new file mode 100644 index 0000000000..00fa462465 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/global-env-rec-eval.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-5 +description: > + Direct call to eval has context set to local context (inside another eval) +---*/ + +var __10_4_2_1_5 = "str"; +function testcase() { + var __10_4_2_1_5 = "str1"; + var r = eval("\ + var __10_4_2_1_5 = \'str2\'; \ + eval(\"\'str2\' === __10_4_2_1_5\")\ + "); + assert(r); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/global-env-rec-fun.js b/js/src/tests/test262/language/eval-code/direct/global-env-rec-fun.js new file mode 100644 index 0000000000..0e9919c551 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/global-env-rec-fun.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-2 +description: > + Direct call to eval has context set to local context (nested function) +---*/ + +var __10_4_2_1_2 = "str"; +function testcase() { + var __10_4_2_1_2 = "str1"; + function foo() { + var __10_4_2_1_2 = "str2"; + assert(eval("\'str2\' === __10_4_2_1_2"), 'direct eval'); + } + foo(); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/global-env-rec-with.js b/js/src/tests/test262/language/eval-code/direct/global-env-rec-with.js new file mode 100644 index 0000000000..1d4c512a80 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/global-env-rec-with.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-4 +description: > + Direct call to eval has context set to local context (with block) +flags: [noStrict] +---*/ + +var __10_4_2_1_4 = "str"; +function testcase() { + var o = new Object(); + o.__10_4_2_1_4 = "str2"; + var __10_4_2_1_4 = "str1"; + with (o) { + assert(eval("\'str2\' === __10_4_2_1_4"), 'direct eval'); + } + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/global-env-rec.js b/js/src/tests/test262/language/eval-code/direct/global-env-rec.js new file mode 100644 index 0000000000..080202f181 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/global-env-rec.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-1 +description: Direct call to eval has context set to local context +---*/ + +var __10_4_2_1_1_1 = "str"; +function testcase() { + var __10_4_2_1_1_1 = "str1"; + assert(eval("\'str1\' === __10_4_2_1_1_1"), 'direct eval'); +} +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/import.js b/js/src/tests/test262/language/eval-code/direct/import.js new file mode 100644 index 0000000000..806b154b0a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/import.js @@ -0,0 +1,27 @@ +// |reftest| module +// 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 `import` declaration may not appear within eval code +esid: sec-scripts +flags: [module] +info: | + Eval code is the source text supplied to the built-in eval function. More + precisely, if the parameter to the built-in eval function is a String, it + is treated as an ECMAScript Script. The eval code for a particular + invocation of eval is the global code portion of that Script. + + A.5 Scripts and Modules + + Script: + ScriptBodyopt + + ScriptBody: + StatementList +---*/ + +assert.throws(SyntaxError, function() { + eval('import v from "./import.js";'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/lex-env-distinct-cls.js b/js/src/tests/test262/language/eval-code/direct/lex-env-distinct-cls.js new file mode 100644 index 0000000000..5ad6cdd481 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/lex-env-distinct-cls.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Direct eval code creates a new declarative environment for lexically-scoped + declarations (class) +info: | + [...] + 9. If direct is true, then + a. Let lexEnv be NewDeclarativeEnvironment(ctx's LexicalEnvironment). + [...] +features: [class] +---*/ + +class outside {} + +eval('class outside {}'); +eval('"use strict"; class outside {}'); + +eval('class xNonStrict {}'); + +assert.sameValue(typeof xNonStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xNonStrict; +}); + +eval('"use strict"; class xStrict {}'); + +assert.sameValue(typeof xStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xStrict; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/lex-env-distinct-const.js b/js/src/tests/test262/language/eval-code/direct/lex-env-distinct-const.js new file mode 100644 index 0000000000..3266575aa7 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/lex-env-distinct-const.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Direct eval code creates a new declarative environment for lexically-scoped + declarations (const) +info: | + [...] + 9. If direct is true, then + a. Let lexEnv be NewDeclarativeEnvironment(ctx's LexicalEnvironment). + [...] +features: [const] +---*/ + +const outside = null; + +eval('const outside = null;'); +eval('"use strict"; const outside = null;'); + +eval('const xNonStrict = null;'); + +assert.sameValue(typeof xNonStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xNonStrict; +}); + +eval('"use strict"; const xStrict = null;'); + +assert.sameValue(typeof xStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xStrict; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/lex-env-distinct-let.js b/js/src/tests/test262/language/eval-code/direct/lex-env-distinct-let.js new file mode 100644 index 0000000000..9539de256b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/lex-env-distinct-let.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Direct eval code creates a new declarative environment for lexically-scoped + declarations (let) +info: | + [...] + 9. If direct is true, then + a. Let lexEnv be NewDeclarativeEnvironment(ctx's LexicalEnvironment). + [...] +features: [let] +---*/ + +let outside = 23; + +eval('let outside;'); +eval('"use strict"; let outside;'); + +eval('let xNonStrict = 3;'); + +assert.sameValue(typeof xNonStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xNonStrict; +}); + +eval('"use strict"; let xStrict = 3;'); + +assert.sameValue(typeof xStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xStrict; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/lex-env-heritage.js b/js/src/tests/test262/language/eval-code/direct/lex-env-heritage.js new file mode 100644 index 0000000000..45bc8da6cb --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/lex-env-heritage.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Direct eval code sets the new declarative environment's outer environment + to that of the current context. +info: | + [...] + 9. If direct is true, then + a. Let lexEnv be NewDeclarativeEnvironment(ctx's LexicalEnvironment). + [...] +features: [let] +---*/ + +var actualStrict; +var actualNonStrict; + +let x = 'outside'; +{ + let x = 'inside'; + actualNonStrict = eval('x;'); + actualStrict = eval('"use strict"; x;'); +} + +assert.sameValue(actualNonStrict, 'inside', 'non strict mode'); +assert.sameValue(actualStrict, 'inside', 'strict mode'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/lex-env-no-init-cls.js b/js/src/tests/test262/language/eval-code/direct/lex-env-no-init-cls.js new file mode 100644 index 0000000000..afcdd425eb --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/lex-env-no-init-cls.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Direct eval code creates `class` bindings prior to evaluation, but does not + initialize them. +info: | + [...] + 14. For each element d in lexDeclarations do + a. NOTE Lexically declared names are only instantiated here but not + initialized. + b. For each element dn of the BoundNames of d do + i. If IsConstantDeclaration of d is true, then + 1. Perform ? lexEnvRec.CreateImmutableBinding(dn, true). + ii. Else, + 2. Perform ? lexEnvRec.CreateMutableBinding(dn, false). + [...] +features: [class] +---*/ + +assert.throws(ReferenceError, function() { + eval('typeof C; class C {}'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/lex-env-no-init-const.js b/js/src/tests/test262/language/eval-code/direct/lex-env-no-init-const.js new file mode 100644 index 0000000000..92908e2e7e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/lex-env-no-init-const.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Direct eval code creates `const` bindings prior to evaluation but does not + initialize them. +info: | + [...] + 14. For each element d in lexDeclarations do + a. NOTE Lexically declared names are only instantiated here but not + initialized. + b. For each element dn of the BoundNames of d do + i. If IsConstantDeclaration of d is true, then + 1. Perform ? lexEnvRec.CreateImmutableBinding(dn, true). + ii. Else, + 2. Perform ? lexEnvRec.CreateMutableBinding(dn, false). + [...] +features: [const] +---*/ + +assert.throws(ReferenceError, function() { + eval('typeof x; const x = null;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/lex-env-no-init-let.js b/js/src/tests/test262/language/eval-code/direct/lex-env-no-init-let.js new file mode 100644 index 0000000000..3545ddc015 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/lex-env-no-init-let.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Direct eval code creates `let` bindings prior to evaluation but does not + initialize them. +info: | + [...] + 14. For each element d in lexDeclarations do + a. NOTE Lexically declared names are only instantiated here but not + initialized. + b. For each element dn of the BoundNames of d do + i. If IsConstantDeclaration of d is true, then + 1. Perform ? lexEnvRec.CreateImmutableBinding(dn, true). + ii. Else, + 2. Perform ? lexEnvRec.CreateMutableBinding(dn, false). + [...] +features: [let] +---*/ + +assert.throws(ReferenceError, function() { + eval('typeof x; let x;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..4a92d54109 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-a-following-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/meth/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments = 'param'"), arguments) { + +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-a-following-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/meth-a-following-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..4f054e4db4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-a-following-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/meth/a-following-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a following parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments"), arguments) { + +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js new file mode 100644 index 0000000000..a9ef306ebd --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-a-preceding-parameter-is-named-arguments-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/meth/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(arguments, p = eval("var arguments = 'param'")) { + +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-a-preceding-parameter-is-named-arguments-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/meth-a-preceding-parameter-is-named-arguments-declare-arguments.js new file mode 100644 index 0000000000..d4c7cc4e87 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-a-preceding-parameter-is-named-arguments-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/meth/a-preceding-parameter-is-named-arguments.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when a preceding parameter is named |arguments|.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(arguments, p = eval("var arguments")) { + +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js new file mode 100644 index 0000000000..0f5851a89a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-func-decl-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/meth/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments = 'param'")) { + function arguments() {} +}}; +assert.throws(SyntaxError, o.f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-func-decl-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-func-decl-declare-arguments.js new file mode 100644 index 0000000000..97eafc7d0f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-func-decl-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/meth/fn-body-cntns-arguments-func-decl.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| function declaration.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments")) { + function arguments() {} +}}; +assert.throws(SyntaxError, o.f); + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..51621ff0aa --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-lex-bind-declare-arguments-and-assign.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/meth/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments = 'param'")) { + let arguments; +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js new file mode 100644 index 0000000000..654ccfc56b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-lex-bind-declare-arguments.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/meth/fn-body-cntns-arguments-lex-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| lexical binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments")) { + let arguments; +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js new file mode 100644 index 0000000000..8ce6fd86a5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-var-bind-declare-arguments-and-assign.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/meth/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments = 'param'")) { + var arguments; +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-var-bind-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-var-bind-declare-arguments.js new file mode 100644 index 0000000000..f6dd3af8f4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-fn-body-cntns-arguments-var-bind-declare-arguments.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/meth/fn-body-cntns-arguments-var-bind.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when the function body contains an |arguments| var-binding.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments")) { + var arguments; +}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js b/js/src/tests/test262/language/eval-code/direct/meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js new file mode 100644 index 0000000000..b642a429d4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-no-pre-existing-arguments-bindings-are-present-declare-arguments-and-assign.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments-and-assign.case +// - src/direct-eval-code/default/meth/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments = 'param'")) {}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js b/js/src/tests/test262/language/eval-code/direct/meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js new file mode 100644 index 0000000000..85c4a2c014 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/meth-no-pre-existing-arguments-bindings-are-present-declare-arguments.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/direct-eval-code/declare-arguments.case +// - src/direct-eval-code/default/meth/no-pre-existing-arguments-bindings-are-present.template +/*--- +description: Declare "arguments" and assign to it in direct eval code (Declare |arguments| when no pre-existing |arguments| bindings are present.) +esid: sec-evaldeclarationinstantiation +flags: [generated, noStrict] +---*/ + + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +let o = { f(p = eval("var arguments")) {}}; +assert.throws(SyntaxError, o.f); + +assert.sameValue("arguments" in this, false, "No global 'arguments' binding"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/new.target-arrow.js b/js/src/tests/test262/language/eval-code/direct/new.target-arrow.js new file mode 100644 index 0000000000..f09af7bfef --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/new.target-arrow.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: > + A direct eval in the functon code of an ArrowFunction may not contain + `new.target` +info: | + - It is a Syntax Error if StatementList Contains NewTarget unless the source + code containing NewTarget is eval code that is being processed by a direct + eval that is contained in function code that is not the function code of an + ArrowFunction. +features: [arrow-function, new.target] +---*/ + +var caught; +var f = () => eval('new.target;'); + +try { + f(); +} catch (err) { + caught = err; +} + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/new.target-fn.js b/js/src/tests/test262/language/eval-code/direct/new.target-fn.js new file mode 100644 index 0000000000..486d01aaed --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/new.target-fn.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: > + A direct eval in the functon code of a non-ArrowFunction may contain + `new.target` +info: | + - It is a Syntax Error if StatementList Contains NewTarget unless the source + code containing NewTarget is eval code that is being processed by a direct + eval that is contained in function code that is not the function code of an + ArrowFunction. +features: [new.target] +---*/ + +var newTarget = null; +var getNewTarget = function() { + newTarget = eval('new.target;'); +}; + +getNewTarget(); + +assert.sameValue(newTarget, undefined); + +new getNewTarget(); + +assert.sameValue(newTarget, getNewTarget); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/new.target.js b/js/src/tests/test262/language/eval-code/direct/new.target.js new file mode 100644 index 0000000000..1f2c49adfc --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/new.target.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: A direct eval in global code may not contain `new.target` +info: | + - It is a Syntax Error if StatementList Contains NewTarget unless the source + code containing NewTarget is eval code that is being processed by a direct + eval that is contained in function code that is not the function code of an + ArrowFunction. +features: [new.target] +---*/ + +var caught; + +try { + eval('new.target;'); +} catch (err) { + caught = err; +} + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/non-definable-function-with-function.js b/js/src/tests/test262/language/eval-code/direct/non-definable-function-with-function.js new file mode 100644 index 0000000000..26dcb5943f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/non-definable-function-with-function.js @@ -0,0 +1,40 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 18.2.1.2 +description: Global functions are not created if conflicting function declarations were detected. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a GeneratorDeclaration. + ii. NOTE If there are multiple FunctionDeclarations for the same name, the last declaration is used. + iii. Let fn be the sole element of the BoundNames of d. + iv. If fn is not an element of declaredFunctionNames, then + 1. If varEnvRec is a global Environment Record, then + a. Let fnDefinable be varEnvRec.CanDeclareGlobalFunction(fn). + b. ReturnIfAbrupt(fnDefinable). + c. If fnDefinable is false, throw TypeError exception. + ... + 14. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + i. Let status be varEnvRec.CreateGlobalFunctionBinding(fn, fo, true). + ii. ReturnIfAbrupt(status). + ... +flags: [noStrict] +---*/ + +try { + eval("function shouldNotBeDefined(){} function NaN(){}"); +} catch (e) { + // Ignore TypeError exception. +} + +assert.sameValue(Object.getOwnPropertyDescriptor(this, "shouldNotBeDefined"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/non-definable-function-with-variable.js b/js/src/tests/test262/language/eval-code/direct/non-definable-function-with-variable.js new file mode 100644 index 0000000000..eae1df64d4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/non-definable-function-with-variable.js @@ -0,0 +1,38 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 18.2.1.2 +description: Global variables are not created if conflicting function declarations were detected. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a GeneratorDeclaration. + ii. NOTE If there are multiple FunctionDeclarations for the same name, the last declaration is used. + iii. Let fn be the sole element of the BoundNames of d. + iv. If fn is not an element of declaredFunctionNames, then + 1. If varEnvRec is a global Environment Record, then + a. Let fnDefinable be varEnvRec.CanDeclareGlobalFunction(fn). + b. ReturnIfAbrupt(fnDefinable). + c. If fnDefinable is false, throw TypeError exception. + ... + 15. For each String vn in declaredVarNames, in list order do + a. If varEnvRec is a global Environment Record, then + i. Let status be varEnvRec.CreateGlobalVarBinding(vn, true). + ii. ReturnIfAbrupt(status). + ... +flags: [noStrict] +---*/ + +try { + eval("var shouldNotBeDefined; function NaN(){}"); +} catch (e) { + // Ignore TypeError exception. +} + +assert.sameValue(Object.getOwnPropertyDescriptor(this, "shouldNotBeDefined"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/non-definable-global-function.js b/js/src/tests/test262/language/eval-code/direct/non-definable-global-function.js new file mode 100644 index 0000000000..71b91fd057 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/non-definable-global-function.js @@ -0,0 +1,34 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 18.2.1.2 +description: Throws a TypeError if a global function cannot be defined. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a GeneratorDeclaration. + ii. NOTE If there are multiple FunctionDeclarations for the same name, the last declaration is used. + iii. Let fn be the sole element of the BoundNames of d. + iv. If fn is not an element of declaredFunctionNames, then + 1. If varEnvRec is a global Environment Record, then + a. Let fnDefinable be varEnvRec.CanDeclareGlobalFunction(fn). + b. ReturnIfAbrupt(fnDefinable). + c. If fnDefinable is false, throw TypeError exception. + ... +flags: [noStrict] +---*/ + +var error; +try { + eval("function NaN(){}"); +} catch (e) { + error = e; +} + +assert(error instanceof TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/non-definable-global-generator.js b/js/src/tests/test262/language/eval-code/direct/non-definable-global-generator.js new file mode 100644 index 0000000000..ebdf1f717a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/non-definable-global-generator.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 18.2.1.2 +description: Throws a TypeError if a global generator function cannot be defined. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a GeneratorDeclaration. + ii. NOTE If there are multiple FunctionDeclarations for the same name, the last declaration is used. + iii. Let fn be the sole element of the BoundNames of d. + iv. If fn is not an element of declaredFunctionNames, then + 1. If varEnvRec is a global Environment Record, then + a. Let fnDefinable be varEnvRec.CanDeclareGlobalFunction(fn). + b. ReturnIfAbrupt(fnDefinable). + c. If fnDefinable is false, throw TypeError exception. + ... +flags: [noStrict] +features: [generators] +---*/ + +var error; +try { + eval("function* NaN(){}"); +} catch (e) { + error = e; +} + +assert(error instanceof TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/non-definable-global-var.js b/js/src/tests/test262/language/eval-code/direct/non-definable-global-var.js new file mode 100644 index 0000000000..920b581fca --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/non-definable-global-var.js @@ -0,0 +1,43 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 18.2.1.2 +description: Throws a TypeError if a global variable cannot be defined. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 10. For each d in varDeclarations, do + a. If d is a VariableDeclaration or a ForBinding, then + i. For each String vn in the BoundNames of d, do + 1. If vn is not an element of declaredFunctionNames, then + a. If varEnvRec is a global Environment Record, then + i. Let vnDefinable be varEnvRec.CanDeclareGlobalVar(vn). + ii. ReturnIfAbrupt(vnDefinable). + iii. If vnDefinable is false, throw TypeError exception. + ... +flags: [noStrict] +---*/ + +var nonExtensible; +try { + Object.preventExtensions(this); + nonExtensible = !Object.isExtensible(this); +} catch (e) { + nonExtensible = false; +} + +// Run test if global object is non-extensible. +if (nonExtensible) { + var error; + try { + eval("var unlikelyVariableName"); + } catch (e) { + error = e; + } + + assert(error instanceof TypeError); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/non-string-object.js b/js/src/tests/test262/language/eval-code/direct/non-string-object.js new file mode 100644 index 0000000000..31b3622d28 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/non-string-object.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is not a string value, return x +es5id: 15.1.2.1_A1.1_T2 +description: Checking all object +---*/ + +//CHECK#1 +var x = {}; +if (eval(x) !== x) { + throw new Test262Error('#1: x = {}; eval(x) === x. Actual: ' + (eval(x))); +} + +//CHECK#2 +x = new Number(1); +if (eval(x) !== x) { + throw new Test262Error('#2: x = new Number(1); eval(x) === x. Actual: ' + (eval(x))); +} + +//CHECK#3 +x = new Boolean(true); +if (eval(x) !== x) { + throw new Test262Error('#3: x = new Boolean(true); eval(x) === x. Actual: ' + (eval(x))); +} + +//CHECK#4 +x = new String("1+1"); +if (eval(x) !== x) { + throw new Test262Error('#4: x = new String("1"); eval(x) === x. Actual: ' + (eval(x))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/non-string-primitive.js b/js/src/tests/test262/language/eval-code/direct/non-string-primitive.js new file mode 100644 index 0000000000..c9257a16e0 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/non-string-primitive.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is not a string value, return x +es5id: 15.1.2.1_A1.1_T1 +description: Checking all primitive +---*/ + +//CHECK#1 +var x = 1; +if (eval(x) !== x) { + throw new Test262Error('#1: x = 1; eval(x) === x. Actual: ' + (eval(x))); +} + +//CHECK#2 +if (eval(1) !== 1) { + throw new Test262Error('#2: eval(1) === 1. Actual: ' + (eval(1))); +} + +//CHECK#3 +if (eval(true) !== true) { + throw new Test262Error('#3: eval(true) === true. Actual: ' + (eval(true))); +} + +//CHECK#4 +if (eval(null) !== null) { + throw new Test262Error('#4: eval(null) === null. Actual: ' + (eval(null))); +} + +//CHECK#5 +if (eval(undefined) !== undefined) { + throw new Test262Error('#5: eval(undefined) === undefined. Actual: ' + (eval(undefined))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/parse-failure-1.js b/js/src/tests/test262/language/eval-code/direct/parse-failure-1.js new file mode 100644 index 0000000000..6da17a25f1 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/parse-failure-1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the parse fails, throw a SyntaxError exception (but see also clause 16) +es5id: 15.1.2.1_A2_T1 +description: > + Checking if execution of "eval("x = 1; x\u000A++"), catch + SyntaxError" passes +---*/ + +//CHECK#1 +var x; +try { + eval("x = 1; x\u000A++"); + throw new Test262Error('#1.1: eval("x = 1; x\\u000A++") must throw a SyntaxError. Actual: ' + (eval("x = 1; x\u000A++"))); +} catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: eval("x = 1; x\\u000A++") must throw a SyntaxError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/parse-failure-2.js b/js/src/tests/test262/language/eval-code/direct/parse-failure-2.js new file mode 100644 index 0000000000..a955884259 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/parse-failure-2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the parse fails, throw a SyntaxError exception (but see also clause 16) +es5id: 15.1.2.1_A2_T2 +description: Checking if execution of "eval("x = 1; x\u000A++")" fails +---*/ + +var x; +assert.throws(SyntaxError, function() { + eval("x = 1; x\u000A++"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/parse-failure-3.js b/js/src/tests/test262/language/eval-code/direct/parse-failure-3.js new file mode 100644 index 0000000000..c25b847623 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/parse-failure-3.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is not normal, then Result(3).type must be throw. + Throw Result(3).value as an exception +es5id: 15.1.2.1_A3.3_T1 +description: Continue statement +---*/ + +//CHECK#1 +try { + eval("continue;"); + throw new Test262Error('#1.1: continue must throw SyntaxError. Actual: ' + (eval("continue;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: continue must throw SyntaxError. Actual ' + (e)); + } +} + +//CHECK#2 +try { + for (var i = 0; i <= 1; i++) { + for (var j = 0; j <= 1; j++) { + eval("continue;"); + } + } + throw new Test262Error('#2.1: continue must throw SyntaxError. Actual: ' + (eval("continue;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#2.2: continue must throw SyntaxError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/parse-failure-4.js b/js/src/tests/test262/language/eval-code/direct/parse-failure-4.js new file mode 100644 index 0000000000..3897fd7b20 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/parse-failure-4.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is not normal, then Result(3).type must be throw. + Throw Result(3).value as an exception +es5id: 15.1.2.1_A3.3_T2 +description: Break statement +---*/ + +//CHECK#1 +try { + eval("break;"); + throw new Test262Error('#1.1: break must throw SyntaxError. Actual: ' + (eval("break;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: break must throw SyntaxError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + for (var i = 0; i <= 1; i++) { + for (var j = 0; j <= 1; j++) { + eval("break;"); + } + } + throw new Test262Error('#2.1: break must throw SyntaxError. Actual: ' + (eval("break;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#2.2: break must throw SyntaxError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/parse-failure-5.js b/js/src/tests/test262/language/eval-code/direct/parse-failure-5.js new file mode 100644 index 0000000000..84cf9012c4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/parse-failure-5.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Result(3).type is not normal, then Result(3).type must be throw. + Throw Result(3).value as an exception +es5id: 15.1.2.1_A3.3_T3 +description: Return statement +---*/ + +//CHECK#1 +try { + eval("return;"); + throw new Test262Error('#1.1: return must throw SyntaxError. Actual: ' + (eval("return;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: return must throw SyntaxError. Actual: ' + (e)); + } +} + +//CHECK#2 + +function f() { eval("return;"); }; + +try { + f(); + throw new Test262Error('#2.1: return must throw SyntaxError. Actual: ' + (f())); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#2.2: return must throw SyntaxError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/parse-failure-6.js b/js/src/tests/test262/language/eval-code/direct/parse-failure-6.js new file mode 100644 index 0000000000..f1c1158628 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/parse-failure-6.js @@ -0,0 +1,19 @@ +// Copyright 2020 Qu Xing. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: For statement +info: | + ... + 9. Perform the following substeps in an implementation-dependent order, possibly interleaving parsing and error detection: + a. Let script be the ECMAScript code that is the result of parsing ! UTF16DecodeString(x),for the goal symbol Script. + If the parse fails, throw a SyntaxError exception. If any early errors are detected, throw a SyntaxError exception + (but see also clause 16). + ... +---*/ + +assert.throws(SyntaxError, function() { + eval("for(;false;)"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/shell.js b/js/src/tests/test262/language/eval-code/direct/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/shell.js diff --git a/js/src/tests/test262/language/eval-code/direct/strict-caller-function-context.js b/js/src/tests/test262/language/eval-code/direct/strict-caller-function-context.js new file mode 100644 index 0000000000..123d31f37b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/strict-caller-function-context.js @@ -0,0 +1,19 @@ +// Copyright (C) 2020 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: Script will be script if strictCaller is true, inside a function context +info: | + ... + 10. If strictCaller is true, let strictEval be true. + ... + 12. Let runningContext be the running execution context. + ... +---*/ + +assert.throws(SyntaxError, function() { + 'use strict'; + eval('var public = 1;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/strict-caller-global-strict.js b/js/src/tests/test262/language/eval-code/direct/strict-caller-global-strict.js new file mode 100644 index 0000000000..0543362906 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/strict-caller-global-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: Script will be script if strictCaller is true +info: | + ... + 10. If strictCaller is true, let strictEval be true. + ... + 12. Let runningContext be the running execution context. + ... +negative: + phase: runtime + type: SyntaxError +flags: [onlyStrict] +---*/ + +// Although the `try` statement is a more precise mechanism for detecting +// runtime errors, the behavior under test is only observable for a direct eval +// call when the call is made from the global scope. This forces the use of +// the more coarse-grained `negative` frontmatter to assert the expected error. + +eval('var public = 1;'); diff --git a/js/src/tests/test262/language/eval-code/direct/strictness-override.js b/js/src/tests/test262/language/eval-code/direct/strictness-override.js new file mode 100644 index 0000000000..381eaee3e8 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/strictness-override.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Evaluated code honors a Use Strict Directive in the Directive Prologue +esid: sec-strict-mode-code +info: | + Eval code is strict mode code if it begins with a Directive Prologue that + contains a Use Strict Directive or if the call to eval is a direct eval + that is contained in strict mode code. +---*/ + +assert.throws(ReferenceError, function() { + eval('"use strict"; unresolvable = null;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-call-arrow.js b/js/src/tests/test262/language/eval-code/direct/super-call-arrow.js new file mode 100644 index 0000000000..e8de867c70 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-call-arrow.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: > + A direct eval in the functon code of an ArrowFunction may not contain + SuperCall +info: | + - It is a Syntax Error if StatementList Contains super unless the source code + containing super is eval code that is being processed by a direct eval that + is contained in function code that is not the function code of an + ArrowFunction. +features: [super, arrow-function] +---*/ + +var caught; +var f = () => eval('super();'); + +try { + f(); +} catch (err) { + caught = err; +} + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-call-fn.js b/js/src/tests/test262/language/eval-code/direct/super-call-fn.js new file mode 100644 index 0000000000..36bedb1003 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-call-fn.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + A direct eval in the functon code of a non-ArrowFunction may not contain + SuperCall +info: | + [...] + 4. Let inMethod be false. + 5. Let inConstructor be false. + 6. If thisEnvRec has a [[HomeObject]] field, then + a. Let inMethod be true. + b. If thisEnvRec.[[FunctionObject]] has a [[Construct]] field, let + inConstructor be true. + 7. Let script be the ECMAScript code that is the result of parsing x, + interpreted as UTF-16 encoded Unicode text as described in 6.1.4, for the + goal symbol Script. If inMethod is false, additional early error rules + from 18.2.1.1.1 are applied. If inConstructor is false, additional early + error rules from 18.2.1.1.2 are applied. If the parse fails, throw a + SyntaxError exception. If any early errors are detected, throw a + SyntaxError or a ReferenceError exception, depending on the type of the + error (but see also clause 16). Parsing and early error detection may be + interweaved in an implementation dependent manner. + + 18.2.1.1.1 Additional Early Error Rules for Eval Outside Methods + + ScriptBody : StatementList + + - It is a Syntax Error if StatementList contains super. +features: [super] +---*/ + +var executed = false; +function f() { + eval('executed = true; super();'); +} + +assert.throws(SyntaxError, function() { + f(); +}); + +assert.sameValue(executed, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-call-method.js b/js/src/tests/test262/language/eval-code/direct/super-call-method.js new file mode 100644 index 0000000000..f9efd69138 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-call-method.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + SuperCall may may only occur in eval code for direct eval within a + constructor method +info: | + [...] + 4. Let inMethod be false. + 5. Let inConstructor be false. + 6. If thisEnvRec has a [[HomeObject]] field, then + a. Let inMethod be true. + b. If thisEnvRec.[[FunctionObject]] has a [[Construct]] field, let + inConstructor be true. + 7. Let script be the ECMAScript code that is the result of parsing x, + interpreted as UTF-16 encoded Unicode text as described in 6.1.4, for the + goal symbol Script. If inMethod is false, additional early error rules + from 18.2.1.1.1 are applied. If inConstructor is false, additional early + error rules from 18.2.1.1.2 are applied. If the parse fails, throw a + SyntaxError exception. If any early errors are detected, throw a + SyntaxError or a ReferenceError exception, depending on the type of the + error (but see also clause 16). Parsing and early error detection may be + interweaved in an implementation dependent manner. + + 18.2.1.1.1 Additional Early Error Rules for Eval Outside Methods + + ScriptBody : StatementList + + - It is a Syntax Error if StatementList contains super. +features: [super] +---*/ + +var evaluatedArg = false; +var obj = { + method() { + // Early errors restricting the usage of SuperCall necessitate the use of + // `eval`. + eval('super(evaluatedArg = true);'); + } +} + +assert.throws(SyntaxError, function() { + obj.method(); +}); + +assert.sameValue( + evaluatedArg, false, 'did not perform ArgumentsListEvaluation' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-call.js b/js/src/tests/test262/language/eval-code/direct/super-call.js new file mode 100644 index 0000000000..3a93338948 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-call.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: A direct eval in global code may not contain SuperCall +info: | + - It is a Syntax Error if StatementList Contains super unless the source code + containing super is eval code that is being processed by a direct eval that + is contained in function code that is not the function code of an + ArrowFunction. +features: [super] +---*/ + +var caught; + +try { + eval('super();'); +} catch (err) { + caught = err; +} + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-prop-arrow.js b/js/src/tests/test262/language/eval-code/direct/super-prop-arrow.js new file mode 100644 index 0000000000..325256f388 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-prop-arrow.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: > + A direct eval in the functon code of an ArrowFunction may not contain + SuperProperty +info: | + - It is a Syntax Error if StatementList Contains super unless the source code + containing super is eval code that is being processed by a direct eval that + is contained in function code that is not the function code of an + ArrowFunction. +features: [super, arrow-function] +---*/ + +var caught; +var f = () => eval('super.property;'); + +try { + f(); +} catch (err) { + caught = err; +} + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-prop-dot-no-home.js b/js/src/tests/test262/language/eval-code/direct/super-prop-dot-no-home.js new file mode 100644 index 0000000000..2ed4cfcdb7 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-prop-dot-no-home.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + SuperProperty may may only occur in eval code for direct eval within a method +info: | + [...] + 4. Let inMethod be false. + 5. Let inConstructor be false. + 6. If thisEnvRec has a [[HomeObject]] field, then + a. Let inMethod be true. + b. If thisEnvRec.[[FunctionObject]] has a [[Construct]] field, let + inConstructor be true. + 7. Let script be the ECMAScript code that is the result of parsing x, + interpreted as UTF-16 encoded Unicode text as described in 6.1.4, for the + goal symbol Script. If inMethod is false, additional early error rules + from 18.2.1.1.1 are applied. If inConstructor is false, additional early + error rules from 18.2.1.1.2 are applied. If the parse fails, throw a + SyntaxError exception. If any early errors are detected, throw a + SyntaxError or a ReferenceError exception, depending on the type of the + error (but see also clause 16). Parsing and early error detection may be + interweaved in an implementation dependent manner. + + 18.2.1.1.1 Additional Early Error Rules for Eval Outside Methods + + ScriptBody : StatementList + + - It is a Syntax Error if StatementList contains super. +features: [super] +---*/ + +var caught; +function f() { + // Early errors restricting the usage of SuperProperty necessitate the use of + // `eval`. + try { + eval('super.x;'); + } catch (err) { + caught = err; + } +} + +f(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-prop-expr-no-home-no-eval.js b/js/src/tests/test262/language/eval-code/direct/super-prop-expr-no-home-no-eval.js new file mode 100644 index 0000000000..ebde503fe0 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-prop-expr-no-home-no-eval.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Expression is not evaluated prior to verification of "super" binding +info: | + [...] + 4. Let inMethod be false. + 5. Let inConstructor be false. + 6. If thisEnvRec has a [[HomeObject]] field, then + a. Let inMethod be true. + b. If thisEnvRec.[[FunctionObject]] has a [[Construct]] field, let + inConstructor be true. + 7. Let script be the ECMAScript code that is the result of parsing x, + interpreted as UTF-16 encoded Unicode text as described in 6.1.4, for the + goal symbol Script. If inMethod is false, additional early error rules + from 18.2.1.1.1 are applied. If inConstructor is false, additional early + error rules from 18.2.1.1.2 are applied. If the parse fails, throw a + SyntaxError exception. If any early errors are detected, throw a + SyntaxError or a ReferenceError exception, depending on the type of the + error (but see also clause 16). Parsing and early error detection may be + interweaved in an implementation dependent manner. + + 18.2.1.1.1 Additional Early Error Rules for Eval Outside Methods + + ScriptBody : StatementList + + - It is a Syntax Error if StatementList contains super. +features: [super] +---*/ + +var evaluated = false; +function f() { + // Early errors restricting the usage of SuperProperty necessitate the use of + // `eval`. + try { + eval('super[evaluated = true];'); + // Evaluation of SuperProperty is expected to fail in this context, but that + // behavior is tested elsewhere, so the error is discarded. + } catch (_) {} +} + +f(); + +assert.sameValue(evaluated, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-prop-expr-no-home.js b/js/src/tests/test262/language/eval-code/direct/super-prop-expr-no-home.js new file mode 100644 index 0000000000..28f6b5a2fd --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-prop-expr-no-home.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + SuperProperty may may only occur in eval code for direct eval within a method +info: | + [...] + 4. Let inMethod be false. + 5. Let inConstructor be false. + 6. If thisEnvRec has a [[HomeObject]] field, then + a. Let inMethod be true. + b. If thisEnvRec.[[FunctionObject]] has a [[Construct]] field, let + inConstructor be true. + 7. Let script be the ECMAScript code that is the result of parsing x, + interpreted as UTF-16 encoded Unicode text as described in 6.1.4, for the + goal symbol Script. If inMethod is false, additional early error rules + from 18.2.1.1.1 are applied. If inConstructor is false, additional early + error rules from 18.2.1.1.2 are applied. If the parse fails, throw a + SyntaxError exception. If any early errors are detected, throw a + SyntaxError or a ReferenceError exception, depending on the type of the + error (but see also clause 16). Parsing and early error detection may be + interweaved in an implementation dependent manner. + + 18.2.1.1.1 Additional Early Error Rules for Eval Outside Methods + + ScriptBody : StatementList + + - It is a Syntax Error if StatementList contains super. +features: [super] +---*/ + +var caught; +function f() { + // Early errors restricting the usage of SuperProperty necessitate the use of + // `eval`. + try { + eval('super["x"];'); + } catch (err) { + caught = err; + } +} + +f(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-prop-method.js b/js/src/tests/test262/language/eval-code/direct/super-prop-method.js new file mode 100644 index 0000000000..a2a59b7c33 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-prop-method.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: > + A direct eval in the functon code of a non-ArrowFunction may contain + SuperProperty +info: | + - It is a Syntax Error if StatementList Contains super unless the source code + containing super is eval code that is being processed by a direct eval that + is contained in function code that is not the function code of an + ArrowFunction. +features: [super] +---*/ + +var superProp = null; +var o = { + test262: null, + method() { + superProp = eval('super.test262;'); + } +}; + +o.method(); + +assert.sameValue(superProp, undefined); + +Object.setPrototypeOf(o, { test262: 262 }); + +o.method(); + +assert.sameValue(superProp, 262); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/super-prop.js b/js/src/tests/test262/language/eval-code/direct/super-prop.js new file mode 100644 index 0000000000..d8fb85e134 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/super-prop.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: A direct eval in global code may not contain SuperProperty +info: | + - It is a Syntax Error if StatementList Contains super unless the source code + containing super is eval code that is being processed by a direct eval that + is contained in function code that is not the function code of an + ArrowFunction. +features: [super] +---*/ + +var caught; + +try { + eval('super.property;'); +} catch (err) { + caught = err; +} + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/switch-case-decl-eval-source-is-strict-nostrict.js b/js/src/tests/test262/language/eval-code/direct/switch-case-decl-eval-source-is-strict-nostrict.js new file mode 100644 index 0000000000..0fea34f10e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/switch-case-decl-eval-source-is-strict-nostrict.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `case` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [noStrict] +---*/ + +var err; + +eval('\ + "use strict";\ + switch (1) {\ + case 1:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/switch-case-decl-eval-source-is-strict-onlystrict-strict.js b/js/src/tests/test262/language/eval-code/direct/switch-case-decl-eval-source-is-strict-onlystrict-strict.js new file mode 100644 index 0000000000..95247fcab7 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/switch-case-decl-eval-source-is-strict-onlystrict-strict.js @@ -0,0 +1,36 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `case` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [onlyStrict] +---*/ + +var err; + +eval('\ + "use strict";\ + switch (1) {\ + case 1:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/switch-case-decl-onlystrict-strict.js b/js/src/tests/test262/language/eval-code/direct/switch-case-decl-onlystrict-strict.js new file mode 100644 index 0000000000..6e520fe08e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/switch-case-decl-onlystrict-strict.js @@ -0,0 +1,35 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `case` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [onlyStrict] +---*/ + +var err; + +eval('\ + switch (1) {\ + case 1:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-nostrict.js b/js/src/tests/test262/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-nostrict.js new file mode 100644 index 0000000000..9eefaae74a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-nostrict.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `default` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [noStrict] +---*/ + +var err; + +eval('\ + "use strict";\ + switch (1) {\ + default:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-onlystrict-strict.js b/js/src/tests/test262/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-onlystrict-strict.js new file mode 100644 index 0000000000..bccbe3014a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-onlystrict-strict.js @@ -0,0 +1,36 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `default` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [onlyStrict] +---*/ + +var err; + +eval('\ + "use strict";\ + switch (1) {\ + default:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/switch-dflt-decl-onlystrict-strict.js b/js/src/tests/test262/language/eval-code/direct/switch-dflt-decl-onlystrict-strict.js new file mode 100644 index 0000000000..64445add6f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/switch-dflt-decl-onlystrict-strict.js @@ -0,0 +1,35 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode: Function declaration + in the `default` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [onlyStrict] +---*/ + +var err; + +eval('\ + switch (1) {\ + default:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/this-value-func-non-strict.js b/js/src/tests/test262/language/eval-code/direct/this-value-func-non-strict.js new file mode 100644 index 0000000000..75b81a742a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/this-value-func-non-strict.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Direct eval code has the same `this` binding as the calling context + (non-strict function scope) +esid: sec-performeval +flags: [noStrict] +---*/ + +var thisValue; + +(function() { + thisValue = eval('this;'); +}()); + +assert.sameValue(thisValue, this); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/this-value-func-strict-caller-strict.js b/js/src/tests/test262/language/eval-code/direct/this-value-func-strict-caller-strict.js new file mode 100644 index 0000000000..7e1dc3c140 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/this-value-func-strict-caller-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Direct eval code has the same `this` binding as the calling context (strict + function scope) +esid: sec-performeval +flags: [onlyStrict] +---*/ + +var thisValue = null; + +(function() { + thisValue = eval('this;'); +}()); + +assert.sameValue(thisValue, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/this-value-func-strict-source.js b/js/src/tests/test262/language/eval-code/direct/this-value-func-strict-source.js new file mode 100644 index 0000000000..16d6267c77 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/this-value-func-strict-source.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Direct eval code has the same `this` binding as the calling context (strict + function scope) +esid: sec-performeval +flags: [noStrict] +---*/ + +var thisValue; + +(function() { + thisValue = eval('"use strict"; this;'); +}()); + +assert.sameValue(thisValue, this); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/this-value-global.js b/js/src/tests/test262/language/eval-code/direct/this-value-global.js new file mode 100644 index 0000000000..01ce1bbd8c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/this-value-global.js @@ -0,0 +1,12 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Direct eval code has the same `this` binding as the calling context (global + scope) +esid: sec-performeval +---*/ + +assert.sameValue(eval('this;'), this); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-init-global-new.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-global-new.js new file mode 100644 index 0000000000..9721943856 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-global-new.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Initialization of new global property +info: | + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalFunctionBinding(fn, fo, true). + [...] + + 8.1.1.4.18 CreateGlobalFunctionBinding + + [...] + 5. If existingProp is undefined or existingProp.[[Configurable]] is true, + then + a. Let desc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, + [[Enumerable]]: true, [[Configurable]]: D}. + 6. Else, + [...] + 7. Perform ? DefinePropertyOrThrow(globalObject, N, desc). + [...] +flags: [noStrict] +includes: [propertyHelper.js] +---*/ + +var initial; + +eval('initial = f; function f() { return 234; }'); + +verifyEnumerable(this, 'f'); +verifyWritable(this, 'f'); +verifyConfigurable(this, 'f'); +assert.sameValue(typeof initial, 'function'); +assert.sameValue(initial(), 234); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-init-global-update-configurable.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-global-update-configurable.js new file mode 100644 index 0000000000..94150361d5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-global-update-configurable.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Modification of previously-existing configurable global property +info: | + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalFunctionBinding(fn, fo, true). + [...] + + 8.1.1.4.18 CreateGlobalFunctionBinding + + [...] + 5. If existingProp is undefined or existingProp.[[Configurable]] is true, + then + a. Let desc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, + [[Enumerable]]: true, [[Configurable]]: D}. + 6. Else, + [...] + 7. Perform ? DefinePropertyOrThrow(globalObject, N, desc). + [...] +flags: [noStrict] +includes: [propertyHelper.js] +---*/ + +var initial = null; + +Object.defineProperty(this, 'f', { + enumerable: false, + writable: false, + configurable: true +}); + +eval('initial = f; function f() { return 345; }'); + +verifyEnumerable(this, 'f'); +verifyWritable(this, 'f'); +verifyConfigurable(this, 'f'); +assert.sameValue(typeof initial, 'function'); +assert.sameValue(initial(), 345); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-init-global-update-non-configurable.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-global-update-non-configurable.js new file mode 100644 index 0000000000..9170f38136 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-global-update-non-configurable.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: > + Modification of previously-existing non-configurable global property +info: | + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalFunctionBinding(fn, fo, true). + [...] + + 8.1.1.4.18 CreateGlobalFunctionBinding + + [...] + 5. If existingProp is undefined or existingProp.[[Configurable]] is true, + then + [...] + 6. Else, + b. Let desc be the PropertyDescriptor{[[Value]]: V }. + 7. Perform ? DefinePropertyOrThrow(globalObject, N, desc). + [...] +flags: [noStrict] +includes: [propertyHelper.js] +---*/ + +var initial; + +Object.defineProperty(this, 'f', { + enumerable: true, + writable: true, + configurable: false +}); + +eval('initial = f; function f() { return 2222; }'); + +verifyEnumerable(this, 'f'); +verifyWritable(this, 'f'); +verifyNotConfigurable(this, 'f'); +assert.sameValue(typeof initial, 'function'); +assert.sameValue(initial(), 2222); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-init-local-new-delete.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-local-new-delete.js new file mode 100644 index 0000000000..c29c8ec1e6 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-local-new-delete.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Newly-created local binding may be deleted +info: | + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + [...] + d. Else, + i. Let bindingExists be varEnvRec.HasBinding(fn). + ii. If bindingExists is false, then + 1. Let status be ! varEnvRec.CreateMutableBinding(fn, true). + 2. Assert: status is not an abrupt completion because of + validation preceding step 12. + 3. Perform ! varEnvRec.InitializeBinding(fn, fo). + [...] +flags: [noStrict] +---*/ + +var initial, postDeletion; +(function() { + eval('initial = f; delete f; postDeletion = function() { f; }; function f() { return 33; }'); +}()); + +assert.sameValue(typeof initial, 'function'); +assert.sameValue(initial(), 33); +assert.throws(ReferenceError, postDeletion, 'binding may be deleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-init-local-new.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-local-new.js new file mode 100644 index 0000000000..a6d414b633 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-local-new.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Initialization of new local binding +info: | + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + [...] + d. Else, + i. Let bindingExists be varEnvRec.HasBinding(fn). + ii. If bindingExists is false, then + 1. Let status be ! varEnvRec.CreateMutableBinding(fn, true). + 2. Assert: status is not an abrupt completion because of + validation preceding step 12. + 3. Perform ! varEnvRec.InitializeBinding(fn, fo). + [...] +flags: [noStrict] +---*/ + +var initial, postAssignment; +(function() { + eval('initial = f; f = 5; postAssignment = f; function f() { return 33; }'); +}()); + +assert.sameValue(typeof initial, 'function'); +assert.sameValue(initial(), 33); +assert.sameValue(postAssignment, 5, 'binding is mutable'); +assert.throws(ReferenceError, function() { + f; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-init-local-update.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-local-update.js new file mode 100644 index 0000000000..3eb172ec8f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-local-update.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Re-declaration of an existing local variable binding +info: | + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + [...] + d. Else, + i. Let bindingExists be varEnvRec.HasBinding(fn). + ii. If bindingExists is false, then + [...] + iii. Else, + 1. Perform ! varEnvRec.SetMutableBinding(fn, fo, false). + [...] +flags: [noStrict] +---*/ + +var initial; + +(function() { + var f = 88; + eval('initial = f; function f() { return 33; }'); +}()); + +assert.sameValue(typeof initial, 'function'); +assert.sameValue(initial(), 33); +assert.throws(ReferenceError, function() { + f; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-init-multi.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-multi.js new file mode 100644 index 0000000000..55f226969d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-init-multi.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Precedence of final declaration when bindings are duplicated +info: | + [...] + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a + GeneratorDeclaration. + [...] + iv. If fn is not an element of declaredFunctionNames, then + [...] + 3. Insert d as the first element of functionsToInitialize. + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + [...] +flags: [noStrict] +---*/ + +var initial; + +eval('initial = f; function f() { return "first"; } function f() { return "second"; }'); + +assert.sameValue(initial(), 'second', 'initial value'); +assert.sameValue(f(), 'second', 'value following declaration evaluation'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-non-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-non-strict.js new file mode 100644 index 0000000000..a34236875d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-non-strict.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +es5id: 10.4.2.1-4-s +description: > + Non-stict mode direct eval code cannot instantiate functions in the + variable environment of the caller +flags: [noStrict] +---*/ + +var typeofInside; + +(function() { + eval('function fun() {}'); + typeofInside = typeof fun; +}()); + +assert.sameValue(typeofInside, 'function'); +assert.sameValue(typeof fun, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-strict-caller-2-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-strict-caller-2-strict.js new file mode 100644 index 0000000000..f7492cf5f2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-strict-caller-2-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.2.1-2-s +description: > + Strict Mode - Strict mode eval code cannot instantiate functions + in the variable environment of the caller to eval +flags: [onlyStrict] +---*/ + +function testcase() { + eval("function _10_4_2_1_2_fun(){}"); + assert.sameValue(typeof _10_4_2_1_2_fun, "undefined"); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-strict-caller-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-strict-caller-strict.js new file mode 100644 index 0000000000..c989e6305e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-strict-caller-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.2-2-s +description: > + Strict Mode - Strict mode eval code cannot instantiate functions + in the variable environment of the caller to eval +flags: [onlyStrict] +---*/ + +function testcase() { + eval("function fun(x){ return x }"); + assert.sameValue(typeof (fun), "undefined"); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-func-strict-source.js b/js/src/tests/test262/language/eval-code/direct/var-env-func-strict-source.js new file mode 100644 index 0000000000..c25f2fd9f4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-func-strict-source.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.2.1-4-s +description: > + Strict Mode - Strict mode eval code cannot instantiate functions + in the variable environment of the caller to eval. +---*/ + +function testcase() { + eval("'use strict'; function _10_4_2_1_4_fun(){}"); + assert.sameValue(typeof _10_4_2_1_4_fun, "undefined"); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-gloabl-lex-strict-caller-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-gloabl-lex-strict-caller-strict.js new file mode 100644 index 0000000000..714cff4694 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-gloabl-lex-strict-caller-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: No variable collision with global lexical binding +info: | + [...] + 5. If strict is false, then + [...] +flags: [onlyStrict] +features: [let] +---*/ + +let x; + +eval('var x;'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-global-lex-non-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-global-lex-non-strict.js new file mode 100644 index 0000000000..326923050f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-global-lex-non-strict.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Variable collision with global lexical binding +info: | + [...] + 5. If strict is false, then + a. If varEnvRec is a global Environment Record, then + i. For each name in varNames, do + 1. If varEnvRec.HasLexicalDeclaration(name) is true, throw a + SyntaxError exception. + 2. NOTE: eval will not create a global var declaration that would + be shadowed by a global lexical declaration. + [...] +negative: + phase: runtime + type: SyntaxError +flags: [noStrict] +features: [let] +---*/ + +let x; + +// Although the `try` statement is a more precise mechanism for detecting +// runtime errors, the behavior under test is only observable for a direct eval +// call when the call is made from the global scope. This forces the use of +// the more coarse-grained `negative` frontmatter to assert the expected error. + +eval('var x;'); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-global-lex-strict-source.js b/js/src/tests/test262/language/eval-code/direct/var-env-global-lex-strict-source.js new file mode 100644 index 0000000000..736088709f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-global-lex-strict-source.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: No variable collision with global lexical binding +info: | + [...] + 5. If strict is false, then + [...] +features: [let] +---*/ + +let x; + +eval('"use strict"; var x;'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-non-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-non-strict.js new file mode 100644 index 0000000000..2134a658cf --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-non-strict.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Variable collision with lexical binding in lower scope +info: | + [...] + 5. If strict is false, then + [...] + d. Repeat while thisLex is not the same as varEnv, + i. Let thisEnvRec be thisLex's EnvironmentRecord. + ii. If thisEnvRec is not an object Environment Record, then + 1. NOTE: The environment of with statements cannot contain any + lexical declaration so it doesn't need to be checked for + var/let hoisting conflicts. + 2. For each name in varNames, do + a. If thisEnvRec.HasBinding(name) is true, then + i. Throw a SyntaxError exception. + b. NOTE: A direct eval will not hoist var declaration over a + like-named lexical declaration. + iii. Let thisLex be thisLex's outer environment reference. + [...] +flags: [noStrict] +features: [let] +---*/ + +assert.throws(SyntaxError, function() { + { + let x; + { + eval('var x;'); + } + } +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-strict-caller-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-strict-caller-strict.js new file mode 100644 index 0000000000..c2e12d467d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-strict-caller-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: No variable collision with lexical binding in lower scope +info: | + [...] + 5. If strict is false, then + [...] +flags: [onlyStrict] +features: [let] +---*/ + +{ + let x; + { + eval('var x;'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-strict-source.js b/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-strict-source.js new file mode 100644 index 0000000000..323d119e2b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-strict-source.js @@ -0,0 +1,20 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: No variable collision with lexical binding in lower scope +info: | + [...] + 5. If strict is false, then + [...] +features: [let] +---*/ + +{ + let x; + { + eval('"use strict"; var x;'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-init-global-exstng.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-global-exstng.js new file mode 100644 index 0000000000..fcfb6ca3a5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-global-exstng.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Declaration does not modify existing global property +info: | + [...] + 16. For each String vn in declaredVarNames, in list order do + a. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalVarBinding(vn, true). + [...] + + 8.1.1.4.17 CreateGlobalVarBinding + + [...] + 5. Let extensible be ? IsExtensible(globalObject). + 6. If hasProperty is false and extensible is true, then + [...] + [...] +flags: [noStrict] +includes: [propertyHelper.js] +---*/ + +var initial; +var x = 23; + +eval('initial = x; var x = 45;'); + +verifyEnumerable(this, 'x'); +verifyWritable(this, 'x'); +verifyNotConfigurable(this, 'x'); + +assert.sameValue(initial, 23); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-init-global-new.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-global-new.js new file mode 100644 index 0000000000..a185100454 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-global-new.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Initialization of new global property +info: | + [...] + 16. For each String vn in declaredVarNames, in list order do + a. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalVarBinding(vn, true). + [...] + + 8.1.1.4.17 CreateGlobalVarBinding + + [...] + 5. Let extensible be ? IsExtensible(globalObject). + 6. If hasProperty is false and extensible is true, then + a. Perform ? ObjRec.CreateMutableBinding(N, D). + b. Perform ? ObjRec.InitializeBinding(N, undefined). + [...] +flags: [noStrict] +includes: [propertyHelper.js] +---*/ + +var initial = null; + +eval('initial = x; var x;'); + +verifyEnumerable(this, 'x'); +verifyWritable(this, 'x'); +verifyConfigurable(this, 'x'); + +assert.sameValue(initial, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-exstng.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-exstng.js new file mode 100644 index 0000000000..231c4b30b5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-exstng.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Re-declaration of an existing local variable binding has no effect +info: | + [...] + 16. For each String vn in declaredVarNames, in list order do + a. If varEnvRec is a global Environment Record, then + [...] + b. Else, + i. Let bindingExists be varEnvRec.HasBinding(vn). + ii. If bindingExists is false, then + [...] + [...] +flags: [noStrict] +---*/ + +var initial; + +(function() { + var x = 44443; + eval('initial = x; var x;'); +}()); + +assert.sameValue(initial, 44443); +assert.throws(ReferenceError, function() { + x; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-new-delete.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-new-delete.js new file mode 100644 index 0000000000..a71bd473d0 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-new-delete.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Newly-created local binding may be deleted +info: | + [...] + 16. For each String vn in declaredVarNames, in list order do + a. If varEnvRec is a global Environment Record, then + [...] + b. Else, + i. Let bindingExists be varEnvRec.HasBinding(vn). + ii. If bindingExists is false, then + 1. Let status be ! varEnvRec.CreateMutableBinding(vn, true). + 2. Assert: status is not an abrupt completion because of + validation preceding step 12. + 3. Perform ! varEnvRec.InitializeBinding(vn, undefined). + [...] +flags: [noStrict] +---*/ + +var initial = null; +var postDeletion; + +(function() { + eval('initial = x; delete x; postDeletion = function() { x; }; var x;'); +}()); + +assert.sameValue(initial, undefined); +assert.throws(ReferenceError, postDeletion); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-new.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-new.js new file mode 100644 index 0000000000..dec991a164 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-new.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Initialization of new variable binding +info: | + [...] + 16. For each String vn in declaredVarNames, in list order do + a. If varEnvRec is a global Environment Record, then + [...] + b. Else, + i. Let bindingExists be varEnvRec.HasBinding(vn). + ii. If bindingExists is false, then + 1. Let status be ! varEnvRec.CreateMutableBinding(vn, true). + 2. Assert: status is not an abrupt completion because of + validation preceding step 12. + 3. Perform ! varEnvRec.InitializeBinding(vn, undefined). + [...] +flags: [noStrict] +---*/ + +var initial = null; +var postAssignment; + +(function() { + eval('initial = x; x = 4; postAssignment = x; var x;'); +}()); + +assert.sameValue(initial, undefined); +assert.sameValue(postAssignment, 4, 'binding is mutable'); +assert.throws(ReferenceError, function() { + x; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-non-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-non-strict.js new file mode 100644 index 0000000000..cc0899eb3e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-non-strict.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.2-2-c-1 +description: > + Direct val code in non-strict mode - can instantiate variable in + calling context +flags: [noStrict] +---*/ + +function testcase() { + var x = 0; + function inner() { + eval("var x = 1"); + assert.sameValue(x, 1, "x"); + } + inner(); +} +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-caller-2-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-caller-2-strict.js new file mode 100644 index 0000000000..13544b0b0a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-caller-2-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.2.1-1gs +description: > + Strict Mode - eval code cannot instantiate variable in the + variable environment of the calling context that invoked the eval + if the code of the calling context is strict code +flags: [onlyStrict] +---*/ + +eval("var x = 7;"); +assert.throws(ReferenceError, function() { + x = 9; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-caller-3-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-caller-3-strict.js new file mode 100644 index 0000000000..0f57069af7 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-caller-3-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.2-3-c-3-s +description: > + Calling code in strict mode - eval cannot instantiate variable in + the global context +flags: [onlyStrict] +---*/ + +var _10_4_2_3_c_3_s = 0; +function testcase() { + eval("var _10_4_2_3_c_3_s = 1"); + assert.sameValue(_10_4_2_3_c_3_s, 0); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-caller-strict.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-caller-strict.js new file mode 100644 index 0000000000..0f7cb3992e --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-caller-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.2-3-c-2-s +description: > + Calling code in strict mode - eval cannot instantiate variable in + the variable environment of the calling context +flags: [onlyStrict] +---*/ + +function testcase() { + var _10_4_2_3_c_2_s = 0; + function _10_4_2_3_c_2_sFunc() { + eval("var _10_4_2_3_c_2_s = 1"); + assert.sameValue(_10_4_2_3_c_2_s, 0); + } + _10_4_2_3_c_2_sFunc(); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-source.js b/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-source.js new file mode 100644 index 0000000000..9156ca7d9b --- /dev/null +++ b/js/src/tests/test262/language/eval-code/direct/var-env-var-strict-source.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.2-3-c-1-s +description: > + Direct eval code in strict mode - cannot instantiate variable in + the variable environment of the calling context +---*/ + +function testcase() { + var _10_4_2_3_c_1_s = 0; + function _10_4_2_3_c_1_sFunc() { + eval("'use strict';var _10_4_2_3_c_1_s = 1"); + assert.sameValue(_10_4_2_3_c_1_s, 0); + } + _10_4_2_3_c_1_sFunc(); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/always-non-strict-strict.js b/js/src/tests/test262/language/eval-code/indirect/always-non-strict-strict.js new file mode 100644 index 0000000000..96d8424b61 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/always-non-strict-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strictness of direct eval is not dependent on strictness of caller +esid: sec-strict-mode-code +info: | + Eval code is strict mode code if it begins with a Directive Prologue that + contains a Use Strict Directive or if the call to eval is a direct eval + that is contained in strict mode code. +flags: [onlyStrict] +---*/ + +var count = 0; + +(0,eval)('var static; count += 1;'); + +assert.sameValue(count, 1); + +(0,eval)('with ({}) {} count += 1;'); + +assert.sameValue(count, 2); + +(0,eval)('unresolvable = null; count += 1;'); + +assert.sameValue(count, 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/block-decl-strict.js b/js/src/tests/test262/language/eval-code/indirect/block-decl-strict.js new file mode 100644 index 0000000000..f2adc904d4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/block-decl-strict.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: AnnexB extension not honored in strict mode +es6id: B.3.3.2 +info: | + Block statement in eval code containing a function declaration + + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then +---*/ + +var err; + +(0,eval)('"use strict";{ function f() {} }'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/browser.js b/js/src/tests/test262/language/eval-code/indirect/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/browser.js diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-block.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-block.js new file mode 100644 index 0000000000..c4d7ac885c --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-block.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is empty, then return + the value undefined +esid: sec-performeval +es5id: 15.1.2.1_A3.2_T1 +description: Block statement +---*/ + +assert.sameValue((0,eval)("{}"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-do-while.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-do-while.js new file mode 100644 index 0000000000..c0fa9f8f24 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-do-while.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +esid: sec-performeval +es5id: 15.1.2.1_A3.2_T6 +description: do-while statement +---*/ + +assert.sameValue((0,eval)("do ; while(false)"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-empty.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-empty.js new file mode 100644 index 0000000000..9bc0b415d6 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-empty.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +esid: sec-performeval +es5id: 15.1.2.1_A3.2_T3 +description: Empty statement +---*/ + +assert.sameValue((0,eval)(";"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-for.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-for.js new file mode 100644 index 0000000000..c864cbee0a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-for.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +esid: sec-performeval +es5id: 15.1.2.1_A3.2_T8 +description: for statement +---*/ + +assert.sameValue((0,eval)("for(false;false;false);"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-if.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-if.js new file mode 100644 index 0000000000..3e7cba8a73 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-if.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +esid: sec-performeval +es5id: 15.1.2.1_A3.2_T4 +description: If statement +---*/ + +assert.sameValue((0,eval)("if (false) ;"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-switch.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-switch.js new file mode 100644 index 0000000000..b8ada36f5d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-switch.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +esid: sec-performeval +es5id: 15.1.2.1_A3.2_T5 +description: Switch statement +---*/ + +assert.sameValue((0,eval)("switch(1){}"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-var.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-var.js new file mode 100644 index 0000000000..0af364f670 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-var.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +esid: sec-performeval +es5id: 15.1.2.1_A3.2_T2 +description: Var statement +---*/ + +assert.sameValue((0,eval)("var x = 1"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-while.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-while.js new file mode 100644 index 0000000000..1218e74bac --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-empty-while.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is empty, + then return the value undefined +esid: sec-performeval +es5id: 15.1.2.1_A3.2_T7 +description: while statement +---*/ + +assert.sameValue((0,eval)("while(false);"), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-expr-obj.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-expr-obj.js new file mode 100644 index 0000000000..5612fd8e74 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-expr-obj.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is a value V, + then return the value V +esid: sec-performeval +es5id: 15.1.2.1_A3.1_T2 +description: Expression statement. Eval return object value +---*/ + +var x = {}; +var y; + +assert.sameValue((0,eval)("y = x"), x, 'AssignmentExpression'); + +assert.sameValue((0,eval)("x"), x, 'IdentifierReference'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-expr-prim.js b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-expr-prim.js new file mode 100644 index 0000000000..6e2d959349 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/cptn-nrml-expr-prim.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is normal and its completion value is a value V, + then return the value V +esid: sec-performeval +es5id: 15.1.2.1_A3.1_T1 +description: Expression statement. Eval return primitive value +---*/ + +var x; +assert.sameValue((0,eval)("x = 1"), 1, 'AssignmentExpression'); + +assert.sameValue((0,eval)("1"), 1, 'NumericLiteral'); + +assert.sameValue((0,eval)("'1'"), '1', 'StringLiteral'); + +x = 1; +assert.sameValue((0,eval)("++x"), 2, 'UpdateExpression'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/export.js b/js/src/tests/test262/language/eval-code/indirect/export.js new file mode 100644 index 0000000000..351c028b81 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/export.js @@ -0,0 +1,27 @@ +// |reftest| module +// 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 `export` declaration may not appear within eval code +esid: sec-scripts +flags: [module] +info: | + Eval code is the source text supplied to the built-in eval function. More + precisely, if the parameter to the built-in eval function is a String, it + is treated as an ECMAScript Script. The eval code for a particular + invocation of eval is the global code portion of that Script. + + A.5 Scripts and Modules + + Script: + ScriptBodyopt + + ScriptBody: + StatementList +---*/ + +assert.throws(SyntaxError, function() { + (0,eval)('export default null;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/global-env-rec-catch.js b/js/src/tests/test262/language/eval-code/indirect/global-env-rec-catch.js new file mode 100644 index 0000000000..805bc933a3 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/global-env-rec-catch.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-3 +description: > + Indirect call to eval has context set to global context (catch + block) +---*/ + +var __10_4_2_1_3 = "str"; +function testcase() { + var _eval = eval; + var __10_4_2_1_3 = "str1"; + try { + throw "error"; + } + catch (e) { + var __10_4_2_1_3 = "str2"; + assert(_eval("\'str\' === __10_4_2_1_3"), 'indirect eval'); + } + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/global-env-rec-eval.js b/js/src/tests/test262/language/eval-code/indirect/global-env-rec-eval.js new file mode 100644 index 0000000000..9d7e908ca4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/global-env-rec-eval.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-5 +description: > + Indirect call to eval has context set to global context (inside + another eval) +---*/ + +var __10_4_2_1_5 = "str"; +function testcase() { + var __10_4_2_1_5 = "str1"; + var r = eval("\ + var _eval = eval; \ + var __10_4_2_1_5 = \'str2\'; \ + _eval(\"\'str\' === __10_4_2_1_5 \") \ + "); + assert(r); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/global-env-rec-fun.js b/js/src/tests/test262/language/eval-code/indirect/global-env-rec-fun.js new file mode 100644 index 0000000000..fb93a149bd --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/global-env-rec-fun.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-2 +description: > + Indirect call to eval has context set to global context (nested + function) +---*/ + +var __10_4_2_1_2 = "str"; +function testcase() { + var _eval = eval; + var __10_4_2_1_2 = "str1"; + function foo() { + var __10_4_2_1_2 = "str2"; + assert(_eval("\'str\' === __10_4_2_1_2"), 'indirect eval'); + } + foo(); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/global-env-rec-with.js b/js/src/tests/test262/language/eval-code/indirect/global-env-rec-with.js new file mode 100644 index 0000000000..ffe1d98e51 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/global-env-rec-with.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-4 +description: > + Indirect call to eval has context set to global context (with + block) +flags: [noStrict] +---*/ + +var __10_4_2_1_4 = "str"; +function testcase() { + var o = new Object(); + o.__10_4_2_1_4 = "str2"; + var _eval = eval; + var __10_4_2_1_4 = "str1"; + with (o) { + assert(_eval("\'str\' === __10_4_2_1_4"), 'indirect eval'); + } + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/global-env-rec.js b/js/src/tests/test262/language/eval-code/indirect/global-env-rec.js new file mode 100644 index 0000000000..3cf25d2e2f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/global-env-rec.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 10.4.2-1-1 +description: Indirect call to eval has context set to global context +---*/ + +var __10_4_2_1_1_1 = "str"; +function testcase() { + var _eval = eval; + var __10_4_2_1_1_1 = "str1"; + assert(_eval("\'str\' === __10_4_2_1_1_1"), 'indirect eval'); +} +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/import.js b/js/src/tests/test262/language/eval-code/indirect/import.js new file mode 100644 index 0000000000..a2d83cfb61 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/import.js @@ -0,0 +1,27 @@ +// |reftest| module +// 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 `import` declaration may not appear within eval code +esid: sec-scripts +flags: [module] +info: | + Eval code is the source text supplied to the built-in eval function. More + precisely, if the parameter to the built-in eval function is a String, it + is treated as an ECMAScript Script. The eval code for a particular + invocation of eval is the global code portion of that Script. + + A.5 Scripts and Modules + + Script: + ScriptBodyopt + + ScriptBody: + StatementList +---*/ + +assert.throws(SyntaxError, function() { + (0,eval)('import v from "./import.js";'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-cls.js b/js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-cls.js new file mode 100644 index 0000000000..695ba3a846 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-cls.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Indirect eval code creates a new declarative environment for + lexically-scoped declarations (class) +info: | + [...] + 9. If direct is true, then + [...] + 10. Else, + a. Let lexEnv be NewDeclarativeEnvironment(evalRealm.[[GlobalEnv]]). + [...] +features: [class] +---*/ + +class outside {} + +(0,eval)('class outside {}'); +(0,eval)('"use strict"; class outside {}'); + +(0,eval)('class xNonStrict {}'); + +assert.sameValue(typeof xNonStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xNonStrict; +}); + +(0,eval)('"use strict"; class xStrict {}'); + +assert.sameValue(typeof xStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xStrict; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-const.js b/js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-const.js new file mode 100644 index 0000000000..db39d7fa7a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-const.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Indirect eval code creates a new declarative environment for + lexically-scoped declarations (const) +info: | + [...] + 9. If direct is true, then + [...] + 10. Else, + a. Let lexEnv be NewDeclarativeEnvironment(evalRealm.[[GlobalEnv]]). + [...] +features: [const] +---*/ + +const outside = null; + +(0,eval)('const outside = null;'); +(0,eval)('"use strict"; const outside = null;'); + +(0,eval)('const xNonStrict = null;'); + +assert.sameValue(typeof xNonStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xNonStrict; +}); + +(0,eval)('"use strict"; const xStrict = null;'); + +assert.sameValue(typeof xStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xStrict; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-let.js b/js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-let.js new file mode 100644 index 0000000000..f640f4dd65 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-let.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Indirect eval code creates a new declarative environment for + lexically-scoped declarations (let) +info: | + [...] + 9. If direct is true, then + [...] + 10. Else, + a. Let lexEnv be NewDeclarativeEnvironment(evalRealm.[[GlobalEnv]]). + [...] +features: [let] +---*/ + +let outside = 23; + +(0,eval)('let outside;'); +(0,eval)('"use strict"; let outside;'); + +(0,eval)('let xNonStrict = 3;'); + +assert.sameValue(typeof xNonStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xNonStrict; +}); + +(0,eval)('"use strict"; let xStrict = 3;'); + +assert.sameValue(typeof xStrict, 'undefined'); +assert.throws(ReferenceError, function() { + xStrict; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/lex-env-heritage.js b/js/src/tests/test262/language/eval-code/indirect/lex-env-heritage.js new file mode 100644 index 0000000000..cfbc5b5d10 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/lex-env-heritage.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Indirect eval code sets the new declarative environment's outer environment + to the global environment. +info: | + [...] + 9. If direct is true, then + [...] + 10. Else, + a. Let lexEnv be NewDeclarativeEnvironment(evalRealm.[[GlobalEnv]]). + [...] +features: [let] +---*/ + +var actualStrict; +var actualNonStrict; + +let x = 'outside'; +{ + let x = 'inside'; + actualNonStrict = (0,eval)('x;'); + actualStrict = (0,eval)('"use strict"; x;'); +} + +assert.sameValue(actualNonStrict, 'outside', 'non strict mode'); +assert.sameValue(actualStrict, 'outside', 'strict mode'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/lex-env-no-init-cls.js b/js/src/tests/test262/language/eval-code/indirect/lex-env-no-init-cls.js new file mode 100644 index 0000000000..7a67b7bfbb --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/lex-env-no-init-cls.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Indirect eval code creates `class` bindings prior to evaluation, but does + not initialize them. +info: | + [...] + 14. For each element d in lexDeclarations do + a. NOTE Lexically declared names are only instantiated here but not + initialized. + b. For each element dn of the BoundNames of d do + i. If IsConstantDeclaration of d is true, then + 1. Perform ? lexEnvRec.CreateImmutableBinding(dn, true). + ii. Else, + 2. Perform ? lexEnvRec.CreateMutableBinding(dn, false). + [...] +features: [class] +---*/ + +assert.throws(ReferenceError, function() { + (0,eval)('typeof C; class C {}'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/lex-env-no-init-const.js b/js/src/tests/test262/language/eval-code/indirect/lex-env-no-init-const.js new file mode 100644 index 0000000000..06d0a49fce --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/lex-env-no-init-const.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Indirect eval code creates `const` bindings prior to evaluation but does + not initialize them. +info: | + [...] + 14. For each element d in lexDeclarations do + a. NOTE Lexically declared names are only instantiated here but not + initialized. + b. For each element dn of the BoundNames of d do + i. If IsConstantDeclaration of d is true, then + 1. Perform ? lexEnvRec.CreateImmutableBinding(dn, true). + ii. Else, + 2. Perform ? lexEnvRec.CreateMutableBinding(dn, false). + [...] +features: [const] +---*/ + +assert.throws(ReferenceError, function() { + (0,eval)('typeof x; const x = null;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/lex-env-no-init-let.js b/js/src/tests/test262/language/eval-code/indirect/lex-env-no-init-let.js new file mode 100644 index 0000000000..f9c8ea401a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/lex-env-no-init-let.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: > + Indirect eval code creates `let` bindings prior to evaluation but does not + initialize them. +info: | + [...] + 14. For each element d in lexDeclarations do + a. NOTE Lexically declared names are only instantiated here but not + initialized. + b. For each element dn of the BoundNames of d do + i. If IsConstantDeclaration of d is true, then + 1. Perform ? lexEnvRec.CreateImmutableBinding(dn, true). + ii. Else, + 2. Perform ? lexEnvRec.CreateMutableBinding(dn, false). + [...] +features: [let] +---*/ + +assert.throws(ReferenceError, function() { + (0,eval)('typeof x; let x;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/new.target.js b/js/src/tests/test262/language/eval-code/indirect/new.target.js new file mode 100644 index 0000000000..d8c28eb742 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/new.target.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: > + An indirect eval may not contain `new.target` +info: | + - It is a Syntax Error if StatementList Contains NewTarget unless the source + code containing NewTarget is eval code that is being processed by a direct + eval that is contained in function code that is not the function code of an + ArrowFunction. +features: [new.target] +---*/ + +var caught; + +try { + (0,eval)('new.target;'); +} catch (err) { + caught = err; +} + +assert.sameValue(typeof caught, 'object', 'object value thrown (global code)'); +assert.sameValue( + caught.constructor, SyntaxError, 'SyntaxError thrown (global code)' +); + +caught = null; + +try { + (function() { + (0,eval)('new.target;'); + })(); +} catch (err) { + caught = err; +} + +assert.sameValue( + typeof caught, 'object', 'object value thrown (function code)' +); +assert.sameValue( + caught.constructor, SyntaxError, 'SyntaxError thrown (function code)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/non-definable-function-with-function.js b/js/src/tests/test262/language/eval-code/indirect/non-definable-function-with-function.js new file mode 100644 index 0000000000..85e36337f3 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/non-definable-function-with-function.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +es6id: 18.2.1.2 +description: > + Global functions are not created if conflicting function declarations were + detected. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a GeneratorDeclaration. + ii. NOTE If there are multiple FunctionDeclarations for the same name, + the last declaration is used. + iii. Let fn be the sole element of the BoundNames of d. + iv. If fn is not an element of declaredFunctionNames, then + 1. If varEnvRec is a global Environment Record, then + a. Let fnDefinable be varEnvRec.CanDeclareGlobalFunction(fn). + b. ReturnIfAbrupt(fnDefinable). + c. If fnDefinable is false, throw TypeError exception. + ... + 14. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + i. Let status be varEnvRec.CreateGlobalFunctionBinding(fn, fo, true). + ii. ReturnIfAbrupt(status). + ... +---*/ + +try { + (0,eval)("function shouldNotBeDefined1() {} function NaN() {} function shouldNotBeDefined2() {}"); +} catch (e) { + // Ignore TypeError exception. +} + +assert.sameValue( + Object.getOwnPropertyDescriptor(this, "shouldNotBeDefined1"), + undefined, + "declaration preceding" +); +assert.sameValue( + Object.getOwnPropertyDescriptor(this, "shouldNotBeDefined2"), + undefined, + "declaration following" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/non-definable-function-with-variable.js b/js/src/tests/test262/language/eval-code/indirect/non-definable-function-with-variable.js new file mode 100644 index 0000000000..4d4ff171ab --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/non-definable-function-with-variable.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +es6id: 18.2.1.2 +description: > + Global variables are not created if conflicting function declarations were + detected. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a GeneratorDeclaration. + ii. NOTE If there are multiple FunctionDeclarations for the same name, the last declaration is used. + iii. Let fn be the sole element of the BoundNames of d. + iv. If fn is not an element of declaredFunctionNames, then + 1. If varEnvRec is a global Environment Record, then + a. Let fnDefinable be varEnvRec.CanDeclareGlobalFunction(fn). + b. ReturnIfAbrupt(fnDefinable). + c. If fnDefinable is false, throw TypeError exception. + ... + 15. For each String vn in declaredVarNames, in list order do + a. If varEnvRec is a global Environment Record, then + i. Let status be varEnvRec.CreateGlobalVarBinding(vn, true). + ii. ReturnIfAbrupt(status). + ... +---*/ + +try { + (0,eval)("var shouldNotBeDefined1; function NaN() {} var shouldNotBeDefined2;"); +} catch (e) { + // Ignore TypeError exception. +} + +assert.sameValue( + Object.getOwnPropertyDescriptor(this, "shouldNotBeDefined1"), + undefined, + "declaration preceding" +); +assert.sameValue( + Object.getOwnPropertyDescriptor(this, "shouldNotBeDefined2"), + undefined, + "declaration following" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/non-definable-global-function.js b/js/src/tests/test262/language/eval-code/indirect/non-definable-global-function.js new file mode 100644 index 0000000000..6843cb663a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/non-definable-global-function.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +es6id: 18.2.1.2 +description: Throws a TypeError if a global function cannot be defined. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a GeneratorDeclaration. + ii. NOTE If there are multiple FunctionDeclarations for the same name, + the last declaration is used. + iii. Let fn be the sole element of the BoundNames of d. + iv. If fn is not an element of declaredFunctionNames, then + 1. If varEnvRec is a global Environment Record, then + a. Let fnDefinable be varEnvRec.CanDeclareGlobalFunction(fn). + b. ReturnIfAbrupt(fnDefinable). + c. If fnDefinable is false, throw TypeError exception. + ... +---*/ + +assert.throws(TypeError, function() { + (0,eval)("function NaN() {}"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/non-definable-global-generator.js b/js/src/tests/test262/language/eval-code/indirect/non-definable-global-generator.js new file mode 100644 index 0000000000..d07c68595a --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/non-definable-global-generator.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +es6id: 18.2.1.2 +description: Throws a TypeError if a global generator function cannot be defined. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a GeneratorDeclaration. + ii. NOTE If there are multiple FunctionDeclarations for the same name, + the last declaration is used. + iii. Let fn be the sole element of the BoundNames of d. + iv. If fn is not an element of declaredFunctionNames, then + 1. If varEnvRec is a global Environment Record, then + a. Let fnDefinable be varEnvRec.CanDeclareGlobalFunction(fn). + b. ReturnIfAbrupt(fnDefinable). + c. If fnDefinable is false, throw TypeError exception. + ... +features: [generators] +---*/ + +assert.throws(TypeError, function() { + (0,eval)("function* NaN() {}"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/non-definable-global-var.js b/js/src/tests/test262/language/eval-code/indirect/non-definable-global-var.js new file mode 100644 index 0000000000..7f25c6d9d4 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/non-definable-global-var.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +es6id: 18.2.1.2 +description: Throws a TypeError if a global variable cannot be defined. +info: | + Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) + + ... + 10. For each d in varDeclarations, do + a. If d is a VariableDeclaration or a ForBinding, then + i. For each String vn in the BoundNames of d, do + 1. If vn is not an element of declaredFunctionNames, then + a. If varEnvRec is a global Environment Record, then + i. Let vnDefinable be varEnvRec.CanDeclareGlobalVar(vn). + ii. ReturnIfAbrupt(vnDefinable). + iii. If vnDefinable is false, throw TypeError exception. + ... +---*/ + +var nonExtensible; +try { + Object.preventExtensions(this); + nonExtensible = !Object.isExtensible(this); +} catch (e) { + nonExtensible = false; +} + +// Run test if global object is non-extensible. +if (nonExtensible) { + assert.throws(TypeError, function() { + (0,eval)("var unlikelyVariableName;"); + }); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/non-string-object.js b/js/src/tests/test262/language/eval-code/indirect/non-string-object.js new file mode 100644 index 0000000000..4d5a7da20d --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/non-string-object.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: If x is not a string value, return x +esid: sec-performeval +es5id: 15.1.2.1_A1.1_T2 +description: Checking all objects +---*/ + +var x = {}; +assert.sameValue((0,eval)(x), x, 'ordinary object'); + +x = new Number(1); +assert.sameValue((0,eval)(x), x, 'Number object'); + +x = new Boolean(true); +assert.sameValue((0,eval)(x), x, 'Boolean object'); + +x = new String("1+1"); +assert.sameValue((0,eval)(x), x, 'String object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/non-string-primitive.js b/js/src/tests/test262/language/eval-code/indirect/non-string-primitive.js new file mode 100644 index 0000000000..fc8af92af6 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/non-string-primitive.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: If x is not a string value, return x +esid: sec-performeval +es5id: 15.1.2.1_A1.1_T1 +description: Checking all primitives +---*/ + +var x = 1; +assert.sameValue((0,eval)(x), x, 'Reference'); + +assert.sameValue((0,eval)(1), 1, 'number'); + +assert.sameValue((0,eval)(true), true, 'boolean'); + +assert.sameValue((0,eval)(null), null, 'null'); + +assert.sameValue((0,eval)(undefined), undefined, 'undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/parse-failure-1.js b/js/src/tests/test262/language/eval-code/indirect/parse-failure-1.js new file mode 100644 index 0000000000..3d6a83da54 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/parse-failure-1.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: If the parse fails, throw a SyntaxError exception (but see also clause 16) +esid: sec-performeval +es5id: 15.1.2.1_A2_T1 +description: > + Checking if execution of "(0,eval)("x = 1; x\u000A++"), catch SyntaxError" + passes +---*/ + +var x; +assert.throws(SyntaxError, function() { + (0,eval)("x = 1; x\u000A++"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/parse-failure-2.js b/js/src/tests/test262/language/eval-code/indirect/parse-failure-2.js new file mode 100644 index 0000000000..cc4762f5af --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/parse-failure-2.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: If the parse fails, throw a SyntaxError exception (but see also clause 16) +esid: sec-performeval +es5id: 15.1.2.1_A2_T2 +description: Checking if execution of "(0,eval)("x = 1; x\u000A++")" fails +negative: + phase: runtime + type: SyntaxError +---*/ + +var x; +(0,eval)("x = 1; x\u000A++"); diff --git a/js/src/tests/test262/language/eval-code/indirect/parse-failure-3.js b/js/src/tests/test262/language/eval-code/indirect/parse-failure-3.js new file mode 100644 index 0000000000..fcedb7e20f --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/parse-failure-3.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is not normal, then Result(3).type must be throw. + Throw Result(3).value as an exception +esid: sec-performeval +es5id: 15.1.2.1_A3.3_T1 +description: Continue statement +---*/ + +assert.throws(SyntaxError, function() { + (0,eval)("continue;"); +}); + +assert.throws(SyntaxError, function() { + for (var i = 0; i <= 1; i++) { + (0,eval)("continue;"); + throw new Test262Error("First iteration should not complete"); + } + throw new Test262Error("Iteration should not complete"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/parse-failure-4.js b/js/src/tests/test262/language/eval-code/indirect/parse-failure-4.js new file mode 100644 index 0000000000..3683440412 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/parse-failure-4.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is not normal, then Result(3).type must be throw. + Throw Result(3).value as an exception +esid: sec-performeval +es5id: 15.1.2.1_A3.3_T2 +description: Break statement +---*/ + +assert.throws(SyntaxError, function() { + (0,eval)("break;"); +}); + +assert.throws(SyntaxError, function() { + for (var i = 0; i <= 1; i++) { + (0,eval)("break;"); + throw new Test262Error("First iteration should not complete"); + } + throw new Test262Error("Iteration should not complete"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/parse-failure-5.js b/js/src/tests/test262/language/eval-code/indirect/parse-failure-5.js new file mode 100644 index 0000000000..b2dd8e95e8 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/parse-failure-5.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +info: | + If Result(3).type is not normal, then Result(3).type must be throw. + Throw Result(3).value as an exception +esid: sec-performeval +es5id: 15.1.2.1_A3.3_T3 +description: Return statement +---*/ + +var value; + +try { + value = (0,eval)("return;"); + throw new Test262Error('#1.1: return must throw SyntaxError. Actual: ' + value); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: return must throw SyntaxError. Actual: ' + e); + } +} + +assert.throws(SyntaxError, function() { + (0,eval)("return;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/parse-failure-6.js b/js/src/tests/test262/language/eval-code/indirect/parse-failure-6.js new file mode 100644 index 0000000000..9bd48d27e7 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/parse-failure-6.js @@ -0,0 +1,19 @@ +// Copyright 2020 Qu Xing. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +description: For statement +info: | + ... + 9. Perform the following substeps in an implementation-dependent order, possibly interleaving parsing and error detection: + a. Let script be the ECMAScript code that is the result of parsing ! UTF16DecodeString(x),for the goal symbol Script. + If the parse fails, throw a SyntaxError exception. If any early errors are detected, throw a SyntaxError exception + (but see also clause 16). + ... +---*/ + +assert.throws(SyntaxError, function() { + (0, eval)("for(;false;)"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/realm.js b/js/src/tests/test262/language/eval-code/indirect/realm.js new file mode 100644 index 0000000000..120e65d058 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/realm.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +es6id: 18.2.1.1 +description: > + Uses the global variable envrionment of the running execution context +info: | + [...] + 12. Let ctx be the running execution context. If direct is true, ctx will be + the execution context that performed the direct eval. If direct is false, + ctx will be the execution context for the invocation of the eval + function. + 13. If direct is true, then + [...] + 14. Else, + a. Let lexEnv be NewDeclarativeEnvironment(evalRealm.[[GlobalEnv]]). + b. Let varEnv be evalRealm.[[GlobalEnv]]. + [...] + 17. Let evalCxt be a new ECMAScript code execution context. + [...] + 21. Set the evalCxt's VariableEnvironment to varEnv. + [...] + 24. Let result be EvalDeclarationInstantiation(body, varEnv, lexEnv, + strictEval). +features: [cross-realm] +---*/ + +var other = $262.createRealm().global; +var otherEval = other.eval; + +otherEval('var x = 23;'); +assert.sameValue(typeof x, 'undefined'); +assert.sameValue(other.x, 23); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/shell.js b/js/src/tests/test262/language/eval-code/indirect/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/shell.js diff --git a/js/src/tests/test262/language/eval-code/indirect/super-call.js b/js/src/tests/test262/language/eval-code/indirect/super-call.js new file mode 100644 index 0000000000..682168f325 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/super-call.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: > + An indirect eval may not contain SuperCall +info: | + - It is a Syntax Error if StatementList Contains super unless the source code + containing super is eval code that is being processed by a direct eval that + is contained in function code that is not the function code of an + ArrowFunction. +features: [super] +---*/ + +var caught; + +try { + (0,eval)('super();'); +} catch (err) { + caught = err; +} + +assert.sameValue(typeof caught, 'object', 'object value thrown (global code)'); +assert.sameValue( + caught.constructor, SyntaxError, 'SyntaxError thrown (global code)' +); + +caught = null; + +try { + ({ + m() { + (0,eval)('super();'); + } + }).m(); +} catch (err) { + caught = err; +} + +assert.sameValue( + typeof caught, 'object', 'object value thrown (function code)' +); +assert.sameValue( + caught.constructor, SyntaxError, 'SyntaxError thrown (function code)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/super-prop.js b/js/src/tests/test262/language/eval-code/indirect/super-prop.js new file mode 100644 index 0000000000..753abd2823 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/super-prop.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-scripts-static-semantics-early-errors +es6id: 15.1.1 +description: > + An indirect eval may not contain SuperProperty +info: | + - It is a Syntax Error if StatementList Contains super unless the source code + containing super is eval code that is being processed by a direct eval that + is contained in function code that is not the function code of an + ArrowFunction. +features: [super] +---*/ + +var caught; + +try { + (0,eval)('super.property;'); +} catch (err) { + caught = err; +} + +assert.sameValue(typeof caught, 'object', 'object value thrown (global code)'); +assert.sameValue( + caught.constructor, SyntaxError, 'SyntaxError thrown (global code)' +); + +caught = null; + +try { + ({ + m() { + (0,eval)('super.property;'); + } + }).m(); +} catch (err) { + caught = err; +} + +assert.sameValue( + typeof caught, 'object', 'object value thrown (function code)' +); +assert.sameValue( + caught.constructor, SyntaxError, 'SyntaxError thrown (function code)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/switch-case-decl-strict.js b/js/src/tests/test262/language/eval-code/indirect/switch-case-decl-strict.js new file mode 100644 index 0000000000..73a2ffade1 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/switch-case-decl-strict.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: AnnexB extension not honored in strict mode +es6id: B.3.3.3 +info: | + Function declaration in the `case` clause of a `switch` statement in eval + code + + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then +---*/ + +var err; + +(0,eval)('\ + "use strict";\ + switch (1) {\ + case 1:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/switch-dflt-decl-strict.js b/js/src/tests/test262/language/eval-code/indirect/switch-dflt-decl-strict.js new file mode 100644 index 0000000000..c272028e04 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/switch-dflt-decl-strict.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: AnnexB extension not honored in strict mode +es6id: B.3.3.3 +info: | + Function declaration in the `default` clause of a `switch` statement in + eval code + + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then +---*/ + +var err; + +(0,eval)('\ + "use strict";\ + switch (1) {\ + default:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/this-value-func.js b/js/src/tests/test262/language/eval-code/indirect/this-value-func.js new file mode 100644 index 0000000000..7a4da686f5 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/this-value-func.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Direct eval code has the same `this` binding as the calling context + (non-strict function scope) +esid: sec-performeval +---*/ + +var thisValue; + +(function() { + thisValue = (0,eval)('this;'); +}()); + +assert.sameValue(thisValue, this); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/this-value-global.js b/js/src/tests/test262/language/eval-code/indirect/this-value-global.js new file mode 100644 index 0000000000..9e67ec79bd --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/this-value-global.js @@ -0,0 +1,12 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Direct eval code has the same `this` binding as the calling context (global + scope) +esid: sec-performeval +---*/ + +assert.sameValue((0,eval)('this;'), this); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-global-new.js b/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-global-new.js new file mode 100644 index 0000000000..5f407fff14 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-global-new.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Initialization of new global property +info: | + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalFunctionBinding(fn, fo, true). + [...] + + 8.1.1.4.18 CreateGlobalFunctionBinding + + [...] + 5. If existingProp is undefined or existingProp.[[Configurable]] is true, + then + a. Let desc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, + [[Enumerable]]: true, [[Configurable]]: D}. + 6. Else, + [...] + 7. Perform ? DefinePropertyOrThrow(globalObject, N, desc). + [...] +includes: [propertyHelper.js] +---*/ + +var initial; + +(0, eval)('initial = f; function f() { return 234; }'); + +verifyEnumerable(this, 'f'); +verifyWritable(this, 'f'); +verifyConfigurable(this, 'f'); +assert.sameValue(typeof initial, 'function'); +assert.sameValue(initial(), 234); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-global-update-configurable.js b/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-global-update-configurable.js new file mode 100644 index 0000000000..5097898821 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-global-update-configurable.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Modification of previously-existing configurable global property +info: | + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalFunctionBinding(fn, fo, true). + [...] + + 8.1.1.4.18 CreateGlobalFunctionBinding + + [...] + 5. If existingProp is undefined or existingProp.[[Configurable]] is true, + then + a. Let desc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, + [[Enumerable]]: true, [[Configurable]]: D}. + 6. Else, + [...] + 7. Perform ? DefinePropertyOrThrow(globalObject, N, desc). + [...] +includes: [propertyHelper.js] +---*/ + +var initial = null; + +Object.defineProperty(this, 'f', { + enumerable: false, + writable: false, + configurable: true +}); + +(0, eval)('initial = f; function f() { return 345; }'); + +verifyEnumerable(this, 'f'); +verifyWritable(this, 'f'); +verifyConfigurable(this, 'f'); +assert.sameValue(typeof initial, 'function'); +assert.sameValue(initial(), 345); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-global-update-non-configurable.js b/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-global-update-non-configurable.js new file mode 100644 index 0000000000..0d807c3a23 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-global-update-non-configurable.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: > + Modification of previously-existing non-configurable global property +info: | + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + c. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalFunctionBinding(fn, fo, true). + [...] + + 8.1.1.4.18 CreateGlobalFunctionBinding + + [...] + 5. If existingProp is undefined or existingProp.[[Configurable]] is true, + then + [...] + 6. Else, + b. Let desc be the PropertyDescriptor{[[Value]]: V }. + 7. Perform ? DefinePropertyOrThrow(globalObject, N, desc). + [...] +includes: [propertyHelper.js] +---*/ + +var initial; + +Object.defineProperty(this, 'f', { + enumerable: true, + writable: true, + configurable: false +}); + +(0,eval)('initial = f; function f() { return 2222; }'); + +verifyEnumerable(this, 'f'); +verifyWritable(this, 'f'); +verifyNotConfigurable(this, 'f'); +assert.sameValue(typeof initial, 'function'); +assert.sameValue(initial(), 2222); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-multi.js b/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-multi.js new file mode 100644 index 0000000000..f7a15cfd79 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-func-init-multi.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Precedence of final declaration when bindings are duplicated +info: | + [...] + 8. For each d in varDeclarations, in reverse list order do + a. If d is neither a VariableDeclaration or a ForBinding, then + i. Assert: d is either a FunctionDeclaration or a + GeneratorDeclaration. + [...] + iv. If fn is not an element of declaredFunctionNames, then + [...] + 3. Insert d as the first element of functionsToInitialize. + [...] + 15. For each production f in functionsToInitialize, do + a. Let fn be the sole element of the BoundNames of f. + b. Let fo be the result of performing InstantiateFunctionObject for f + with argument lexEnv. + [...] +---*/ + +var initial; + +(0,eval)('initial = f; function f() { return "first"; } function f() { return "second"; }'); + +assert.sameValue(initial(), 'second', 'initial value'); +assert.sameValue(f(), 'second', 'value following declaration evaluation'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-func-non-strict.js b/js/src/tests/test262/language/eval-code/indirect/var-env-func-non-strict.js new file mode 100644 index 0000000000..64920d29fe --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-func-non-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +es5id: 10.4.2-2-s +description: > + Non-stict mode indirect eval code cannot instantiate functions in the + variable environment of the caller +---*/ + +var typeofInside; + +(function() { + (0,eval)("function fun() {}"); + typeofInside = typeof fun; +}()); + +assert.sameValue(typeofInside, "function"); +assert.sameValue(typeof fun, "function"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-func-strict.js b/js/src/tests/test262/language/eval-code/indirect/var-env-func-strict.js new file mode 100644 index 0000000000..bea4105059 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-func-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +es5id: 10.4.2.1-4-s +description: > + Strict Mode - Strict mode eval code cannot instantiate functions + in the variable environment of the caller to eval. +---*/ + +var typeofInside; + +(function() { + (0,eval)("'use strict'; function fun(){}"); + typeofInside = typeof fun; +}()); + +assert.sameValue(typeofInside, "undefined"); +assert.sameValue(typeof fun, "undefined"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-global-lex-non-strict.js b/js/src/tests/test262/language/eval-code/indirect/var-env-global-lex-non-strict.js new file mode 100644 index 0000000000..062a03fea9 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-global-lex-non-strict.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Variable collision with global lexical binding +info: | + [...] + 5. If strict is false, then + a. If varEnvRec is a global Environment Record, then + i. For each name in varNames, do + 1. If varEnvRec.HasLexicalDeclaration(name) is true, throw a + SyntaxError exception. + 2. NOTE: eval will not create a global var declaration that would + be shadowed by a global lexical declaration. + [...] +features: [let] +---*/ + +let x; +var caught; + +// The `assert.throws` helper function would interfere with the semantics under +// test. +try { + (0,eval)('var x;'); +} catch (err) { + caught = err; +} + +assert.notSameValue(caught, undefined); +assert.sameValue(caught.constructor, SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-global-lex-strict.js b/js/src/tests/test262/language/eval-code/indirect/var-env-global-lex-strict.js new file mode 100644 index 0000000000..6a1b44a9d2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-global-lex-strict.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: No variable collision with global lexical binding +info: | + [...] + 5. If strict is false, then + [...] +features: [let] +---*/ + +let x; + +(0,eval)('"use strict"; var x;'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-lower-lex-non-strict.js b/js/src/tests/test262/language/eval-code/indirect/var-env-lower-lex-non-strict.js new file mode 100644 index 0000000000..f79d7d33e8 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-lower-lex-non-strict.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: No variable collision with lexical binding in lower scope +info: | + [...] + 5. If strict is false, then + [...] + d. Repeat while thisLex is not the same as varEnv, + [...] +features: [let] +---*/ + +{ + let x; + { + (0,eval)('var x;'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-lower-lex-strict.js b/js/src/tests/test262/language/eval-code/indirect/var-env-lower-lex-strict.js new file mode 100644 index 0000000000..1f3b761ed8 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-lower-lex-strict.js @@ -0,0 +1,20 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: No variable collision with lexical binding in lower scope +info: | + [...] + 5. If strict is false, then + [...] +features: [let] +---*/ + +{ + let x; + { + (0,eval)('"use strict"; var x;'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-var-init-global-exstng.js b/js/src/tests/test262/language/eval-code/indirect/var-env-var-init-global-exstng.js new file mode 100644 index 0000000000..91e3fc63bd --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-var-init-global-exstng.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Declaration does not modify existing global property +info: | + [...] + 16. For each String vn in declaredVarNames, in list order do + a. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalVarBinding(vn, true). + [...] + + 8.1.1.4.17 CreateGlobalVarBinding + + [...] + 5. Let extensible be ? IsExtensible(globalObject). + 6. If hasProperty is false and extensible is true, then + [...] + [...] +includes: [propertyHelper.js] +---*/ + +var initial; +var x = 23; + +(0, eval)('initial = x; var x = 45;'); + +verifyEnumerable(this, 'x'); +verifyWritable(this, 'x'); +verifyNotConfigurable(this, 'x'); + +assert.sameValue(initial, 23); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-var-init-global-new.js b/js/src/tests/test262/language/eval-code/indirect/var-env-var-init-global-new.js new file mode 100644 index 0000000000..4dc8a70594 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-var-init-global-new.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-evaldeclarationinstantiation +description: Initialization of new global property +info: | + [...] + 16. For each String vn in declaredVarNames, in list order do + a. If varEnvRec is a global Environment Record, then + i. Perform ? varEnvRec.CreateGlobalVarBinding(vn, true). + [...] + + 8.1.1.4.17 CreateGlobalVarBinding + + [...] + 5. Let extensible be ? IsExtensible(globalObject). + 6. If hasProperty is false and extensible is true, then + a. Perform ? ObjRec.CreateMutableBinding(N, D). + b. Perform ? ObjRec.InitializeBinding(N, undefined). + [...] +includes: [propertyHelper.js] +---*/ + +var initial = null; + +(0, eval)('initial = x; var x = 9;'); + +verifyEnumerable(this, 'x'); +verifyWritable(this, 'x'); +verifyConfigurable(this, 'x'); + +assert.sameValue(initial, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-var-non-strict.js b/js/src/tests/test262/language/eval-code/indirect/var-env-var-non-strict.js new file mode 100644 index 0000000000..8b988997b9 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-var-non-strict.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-performeval +es5id: 10.4.2-2-c-1 +description: Indirect eval code cannot instantiate variable in calling context +---*/ + +(function() { + var x = 0; + (0,eval)("var x = 1;"); + assert.sameValue(x, 0, "x"); +}()); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/indirect/var-env-var-strict.js b/js/src/tests/test262/language/eval-code/indirect/var-env-var-strict.js new file mode 100644 index 0000000000..22a9749e68 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/indirect/var-env-var-strict.js @@ -0,0 +1,18 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.2.1_A1 +description: > + Strict indirect eval should not leak top level declarations into + the global scope +---*/ + +if (!('foo' in this)) { + (1,eval)('"use strict"; var foo = 88;'); + if ('foo' in this) { + throw new Test262Error("Strict indirect eval leaked a top level declaration"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/eval-code/shell.js b/js/src/tests/test262/language/eval-code/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/eval-code/shell.js |