v8/test/mjsunit/harmony/regress/regress-crbug-571149.js
rossberg 92e6f7a315 Don't pre-initialise block contexts with holes
Respective declarations will explicitly initialise slots
with the hole anyway, so this always was unnecessary.
With varblocks it even became wrong, because block contexts
may now host var bindings, which want undefined.

Fixes the hole leaking when accessing an unitialised,
block-context-allocated var.

R=neis@chromium.org
BUG=571149
LOG=N

Review URL: https://codereview.chromium.org/1584243002

Cr-Commit-Position: refs/heads/master@{#33309}
2016-01-14 18:04:35 +00:00

20 lines
554 B
JavaScript

// 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.
(function(a = 0){
var x; // allocated in a var block, due to use of default parameter
(function() { return !x })();
})();
(function({a}){
var x; // allocated in a var block, due to use of parameter destructuring
(function() { return !x })();
})({});
(function(...a){
var x; // allocated in a var block, due to use of rest parameter
(function() { return !x })();
})();