diff options
Diffstat (limited to 'js/src/tests/test262/annexB/language/eval-code/direct/script-decl-lex-collision-in-sloppy-mode.js')
-rw-r--r-- | js/src/tests/test262/annexB/language/eval-code/direct/script-decl-lex-collision-in-sloppy-mode.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/language/eval-code/direct/script-decl-lex-collision-in-sloppy-mode.js b/js/src/tests/test262/annexB/language/eval-code/direct/script-decl-lex-collision-in-sloppy-mode.js new file mode 100644 index 0000000000..58d5a125b5 --- /dev/null +++ b/js/src/tests/test262/annexB/language/eval-code/direct/script-decl-lex-collision-in-sloppy-mode.js @@ -0,0 +1,23 @@ +// Copyright (C) 2023 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-globaldeclarationinstantiation +description: Let binding collision with existing var declaration that was created for hoisted function. +info: | + [...] + 3. For each element name of lexNames, do + a. If env.HasVarDeclaration(name) is true, throw a SyntaxError exception. +flags: [noStrict] +---*/ + +eval('if (true) { function test262Fn() {} }'); + +assert.throws(SyntaxError, function() { + $262.evalScript('var x; let test262Fn;'); +}); + +assert.throws(ReferenceError, function() { + x; +}, 'no bindings created'); + +reportCompare(0, 0); |