diff options
Diffstat (limited to 'deps/v8/test/mjsunit/regress/regress-loop-var-assign-without-block-scope.js')
-rw-r--r-- | deps/v8/test/mjsunit/regress/regress-loop-var-assign-without-block-scope.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/regress/regress-loop-var-assign-without-block-scope.js b/deps/v8/test/mjsunit/regress/regress-loop-var-assign-without-block-scope.js new file mode 100644 index 0000000000..8c85c1380f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-loop-var-assign-without-block-scope.js @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax +function f() { + // Loop with a body that's not wrapped in a block. + for (i = 0; i < 2; i++) + var x = i, // var x that's assigned on each iteration + y = y||(()=>x), // single arrow function that returns x + z = (%OptimizeFunctionOnNextCall(y), y()); // optimize y on first iteration + return y() +}; +assertEquals(1, f()) |