Commit 18534dff authored by adamk's avatar adamk Committed by Commit bot

Don't throw on assignment to function name binding in harmony sloppy mode

BUG=v8:4482
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#31218}
parent e887d423
......@@ -4717,12 +4717,9 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody(
// NOTE: We create a proxy and resolve it here so that in the
// future we can change the AST to only refer to VariableProxies
// instead of Variables and Proxies as is the case now.
Token::Value fvar_init_op = Token::INIT_CONST_LEGACY;
bool use_strict_const = is_strict(scope_->language_mode()) ||
(!allow_legacy_const() && allow_harmony_sloppy());
if (use_strict_const) {
fvar_init_op = Token::INIT_CONST;
}
const bool use_strict_const = is_strict(scope_->language_mode());
Token::Value fvar_init_op =
use_strict_const ? Token::INIT_CONST : Token::INIT_CONST_LEGACY;
VariableMode fvar_mode = use_strict_const ? CONST : CONST_LEGACY;
Variable* fvar = new (zone())
Variable(scope_, function_name, fvar_mode, Variable::NORMAL,
......
// 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-sloppy --nolegacy-const
assertEquals("function", (function f() { f = 42; return typeof f })());
assertEquals("function",
(function* g() { g = 42; yield typeof g })().next().value);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment