2016-09-27 09:48:17 +00:00
|
|
|
// Copyright 2016 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.
|
|
|
|
|
2016-12-06 13:23:29 +00:00
|
|
|
// Flags: --lazy-inner-functions
|
|
|
|
|
2016-09-27 09:48:17 +00:00
|
|
|
(function TestLazyInnerFunctionCallsEval() {
|
|
|
|
var i = (function eager_outer() {
|
2016-12-06 13:23:29 +00:00
|
|
|
var outer_var = 41; // Should be context-allocated
|
|
|
|
function lazy_inner() {
|
|
|
|
return eval("outer_var");
|
|
|
|
}
|
|
|
|
return lazy_inner;
|
|
|
|
})();
|
|
|
|
assertEquals(41, i());
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function TestLazyInnerFunctionDestructuring() {
|
|
|
|
var i = (function eager_outer() {
|
|
|
|
var outer_var = 41; // Should be context-allocated
|
2016-09-27 09:48:17 +00:00
|
|
|
function lazy_inner() {
|
2016-12-06 13:23:29 +00:00
|
|
|
// This introduces b and refers to outer_var.
|
|
|
|
var {outer_var : b} = {outer_var};
|
|
|
|
return b;
|
2016-09-27 09:48:17 +00:00
|
|
|
}
|
|
|
|
return lazy_inner;
|
|
|
|
})();
|
|
|
|
assertEquals(41, i());
|
|
|
|
})();
|