diff options
Diffstat (limited to 'deps/v8/test/mjsunit/es6/block-eval-var-over-let.js')
-rw-r--r-- | deps/v8/test/mjsunit/es6/block-eval-var-over-let.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/deps/v8/test/mjsunit/es6/block-eval-var-over-let.js b/deps/v8/test/mjsunit/es6/block-eval-var-over-let.js index e16d7a02a6..784f5d2f42 100644 --- a/deps/v8/test/mjsunit/es6/block-eval-var-over-let.js +++ b/deps/v8/test/mjsunit/es6/block-eval-var-over-let.js @@ -141,15 +141,15 @@ try { } assertTrue(caught); -caught = false -try { - (function() { - { - let x = 1; - eval('{ function x() {} }'); - } - })(); -} catch (e) { - caught = true; -} -assertFalse(caught); +// See ES#sec-web-compat-evaldeclarationinstantiation. Sloppy block functions +// inside of blocks in eval behave similar to regular sloppy block function +// hoisting: the var declaration on the function level is only created if +// it would not cause a syntax error. A masking let would cause a conflicting +// var declaration syntax error, and hence the var isn't introduced. +(function() { + { + let x = 1; + eval('{ function x() {} }'); + assertEquals(1, x); + } +})(); |