From e971005638f41e7b0f67e91f6e85552e164e13ce Mon Sep 17 00:00:00 2001 From: adamk Date: Fri, 13 Nov 2015 09:10:37 -0800 Subject: [PATCH] Run the materialized literal reindexer on default parameter initializers R=rossberg@chromium.org BUG=chromium:554865 LOG=n Review URL: https://codereview.chromium.org/1442653004 Cr-Commit-Position: refs/heads/master@{#31989} --- src/parser.cc | 1 + test/mjsunit/regress/regress-554865.js | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 test/mjsunit/regress/regress-554865.js diff --git a/src/parser.cc b/src/parser.cc index 22efbac101..2ee9444054 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -4148,6 +4148,7 @@ void ParserTraits::ReindexLiterals(const ParserFormalParameters& parameters) { for (const auto p : parameters.params) { if (p.pattern != nullptr) reindexer.Reindex(p.pattern); + if (p.initializer != nullptr) reindexer.Reindex(p.initializer); } if (parameters.has_rest) { diff --git a/test/mjsunit/regress/regress-554865.js b/test/mjsunit/regress/regress-554865.js new file mode 100644 index 0000000000..9b66d79b35 --- /dev/null +++ b/test/mjsunit/regress/regress-554865.js @@ -0,0 +1,10 @@ +// 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. +// +// Flags: --harmony-default-parameters + +(function() { + var x = {}; + ((y = [42]) => assertEquals(42, y[0]))(); +})();