diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc index 183e7148d1..c7b2c93b2b 100644 --- a/src/compiler/ast-graph-builder.cc +++ b/src/compiler/ast-graph-builder.cc @@ -2429,7 +2429,7 @@ void AstGraphBuilder::VisitCall(Call* expr) { } } Node* language = jsgraph()->Constant(language_mode()); - Node* position = jsgraph()->Constant(info()->scope()->start_position()); + Node* position = jsgraph()->Constant(current_scope()->start_position()); const Operator* op = javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); Node* pair = diff --git a/test/mjsunit/regress/regress-eval-context.js b/test/mjsunit/regress/regress-eval-context.js new file mode 100644 index 0000000000..e376282461 --- /dev/null +++ b/test/mjsunit/regress/regress-eval-context.js @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +(function() { + 'use strict'; + var x = 0; + + { + let x = 1; + assertEquals(1, eval("x")); + } + + { + let y = 2; + assertEquals(0, eval("x")); + } + + assertEquals(0, eval("x")); +})();