Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/parsing/preparser.cc

Issue 2579303002: Preparsing inner funcs: declare arguments for preparsed scopes (Closed)
Patch Set: added this Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // separately by Parser::SkipLazyFunctionBody. 124 // separately by Parser::SkipLazyFunctionBody.
125 ParseFormalParameterList(&formals, CHECK_OK_VALUE(kPreParseSuccess)); 125 ParseFormalParameterList(&formals, CHECK_OK_VALUE(kPreParseSuccess));
126 Expect(Token::RPAREN, CHECK_OK_VALUE(kPreParseSuccess)); 126 Expect(Token::RPAREN, CHECK_OK_VALUE(kPreParseSuccess));
127 int formals_end_position = scanner()->location().end_pos; 127 int formals_end_position = scanner()->location().end_pos;
128 128
129 CheckArityRestrictions( 129 CheckArityRestrictions(
130 formals.arity, kind, formals.has_rest, function_scope->start_position(), 130 formals.arity, kind, formals.has_rest, function_scope->start_position(),
131 formals_end_position, CHECK_OK_VALUE(kPreParseSuccess)); 131 formals_end_position, CHECK_OK_VALUE(kPreParseSuccess));
132 has_duplicate_parameters = 132 has_duplicate_parameters =
133 !classifier()->is_valid_formal_parameter_list_without_duplicates(); 133 !classifier()->is_valid_formal_parameter_list_without_duplicates();
134
135 if (track_unresolved_variables_) {
136 function_scope->DeclareVariableName(
137 ast_value_factory()->arguments_string(), VAR);
138 function_scope->DeclareVariableName(ast_value_factory()->this_string(),
139 VAR);
140 }
134 } 141 }
135 142
136 Expect(Token::LBRACE, CHECK_OK_VALUE(kPreParseSuccess)); 143 Expect(Token::LBRACE, CHECK_OK_VALUE(kPreParseSuccess));
137 LazyParsingResult result = ParseStatementListAndLogFunction( 144 LazyParsingResult result = ParseStatementListAndLogFunction(
138 &formals, has_duplicate_parameters, may_abort, ok); 145 &formals, has_duplicate_parameters, may_abort, ok);
146
139 use_counts_ = nullptr; 147 use_counts_ = nullptr;
140 track_unresolved_variables_ = false; 148 track_unresolved_variables_ = false;
141 149
142 if (result == kLazyParsingAborted) { 150 if (result == kLazyParsingAborted) {
143 return kPreParseAbort; 151 return kPreParseAbort;
144 } else if (stack_overflow()) { 152 } else if (stack_overflow()) {
145 return kPreParseStackOverflow; 153 return kPreParseStackOverflow;
146 } else if (!*ok) { 154 } else if (!*ok) {
147 DCHECK(pending_error_handler_->has_pending_error()); 155 DCHECK(pending_error_handler_->has_pending_error());
148 } else { 156 } else {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 322 }
315 } 323 }
316 } 324 }
317 325
318 #undef CHECK_OK 326 #undef CHECK_OK
319 #undef CHECK_OK_CUSTOM 327 #undef CHECK_OK_CUSTOM
320 328
321 329
322 } // namespace internal 330 } // namespace internal
323 } // namespace v8 331 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698