OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |