Commit 9bc4e560 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[parser] Fix declaration order of "arguments" and func name.

They were in the wrong order in PreParser, which caused problem for "function
arguments() { ... }".

BUG=chromium:801772

Change-Id: Ia04c8c8c0a5d641fd1db0746dc3312c83ebcaf24
Reviewed-on: https://chromium-review.googlesource.com/865900Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50640}
parent 56eac828
...@@ -207,12 +207,12 @@ PreParser::PreParseResult PreParser::PreParseFunction( ...@@ -207,12 +207,12 @@ PreParser::PreParseResult PreParser::PreParseFunction(
if (!IsArrowFunction(kind) && track_unresolved_variables_ && if (!IsArrowFunction(kind) && track_unresolved_variables_ &&
result == kLazyParsingComplete) { result == kLazyParsingComplete) {
DeclareFunctionNameVar(function_name, function_type, function_scope);
// Declare arguments after parsing the function since lexical 'arguments' // Declare arguments after parsing the function since lexical 'arguments'
// masks the arguments object. Declare arguments before declaring the // masks the arguments object. Declare arguments before declaring the
// function var since the arguments object masks 'function arguments'. // function var since the arguments object masks 'function arguments'.
function_scope->DeclareArguments(ast_value_factory()); function_scope->DeclareArguments(ast_value_factory());
DeclareFunctionNameVar(function_name, function_type, function_scope);
} }
use_counts_ = nullptr; use_counts_ = nullptr;
......
// Copyright 2018 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 foo(f) { f(); }
foo(function arguments() {
function skippable() { }
});
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