Commit b695c388 authored by marja's avatar marja Committed by Commit bot

Preparsing inner funcs: declare arguments for preparsed scopes

This makes maybe_assigned correct (instead of being overly pessimistic
in the following case):

function f() { function g() { arguments; }; }

(Tests upcoming as part of https://codereview.chromium.org/2580833005 )

BUG=v8:5501, v8:5678
R=verwaest@chromium.org, neis@chromium.org

Review-Url: https://codereview.chromium.org/2579303002
Cr-Commit-Position: refs/heads/master@{#41787}
parent f63f64ca
......@@ -131,11 +131,19 @@ PreParser::PreParseResult PreParser::PreParseFunction(
formals_end_position, CHECK_OK_VALUE(kPreParseSuccess));
has_duplicate_parameters =
!classifier()->is_valid_formal_parameter_list_without_duplicates();
if (track_unresolved_variables_) {
function_scope->DeclareVariableName(
ast_value_factory()->arguments_string(), VAR);
function_scope->DeclareVariableName(ast_value_factory()->this_string(),
VAR);
}
}
Expect(Token::LBRACE, CHECK_OK_VALUE(kPreParseSuccess));
LazyParsingResult result = ParseStatementListAndLogFunction(
&formals, has_duplicate_parameters, may_abort, ok);
use_counts_ = nullptr;
track_unresolved_variables_ = false;
......
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