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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } | 134 } |
135 | 135 |
136 Expect(Token::LBRACE, CHECK_OK_VALUE(kPreParseSuccess)); | 136 Expect(Token::LBRACE, CHECK_OK_VALUE(kPreParseSuccess)); |
137 LazyParsingResult result = ParseStatementListAndLogFunction( | 137 LazyParsingResult result = ParseStatementListAndLogFunction( |
138 &formals, has_duplicate_parameters, may_abort, ok); | 138 &formals, has_duplicate_parameters, may_abort, ok); |
139 | 139 |
| 140 if (is_sloppy(function_scope->language_mode())) { |
| 141 function_scope->HoistSloppyBlockFunctions(nullptr); |
| 142 } |
| 143 |
140 if (!IsArrowFunction(kind) && track_unresolved_variables_) { | 144 if (!IsArrowFunction(kind) && track_unresolved_variables_) { |
141 // Declare arguments after parsing the function since lexical 'arguments' | 145 // Declare arguments after parsing the function since lexical 'arguments' |
142 // masks the arguments object. Declare arguments before declaring the | 146 // masks the arguments object. Declare arguments before declaring the |
143 // function var since the arguments object masks 'function arguments'. | 147 // function var since the arguments object masks 'function arguments'. |
144 function_scope->DeclareArguments(ast_value_factory()); | 148 function_scope->DeclareArguments(ast_value_factory()); |
145 } | 149 } |
146 | 150 |
147 if (is_sloppy(function_scope->language_mode())) { | |
148 function_scope->HoistSloppyBlockFunctions(nullptr); | |
149 } | |
150 | |
151 use_counts_ = nullptr; | 151 use_counts_ = nullptr; |
152 track_unresolved_variables_ = false; | 152 track_unresolved_variables_ = false; |
153 | 153 |
154 if (result == kLazyParsingAborted) { | 154 if (result == kLazyParsingAborted) { |
155 return kPreParseAbort; | 155 return kPreParseAbort; |
156 } else if (stack_overflow()) { | 156 } else if (stack_overflow()) { |
157 return kPreParseStackOverflow; | 157 return kPreParseStackOverflow; |
158 } else if (!*ok) { | 158 } else if (!*ok) { |
159 DCHECK(pending_error_handler_->has_pending_error()); | 159 DCHECK(pending_error_handler_->has_pending_error()); |
160 } else { | 160 } else { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 } | 318 } |
319 } | 319 } |
320 | 320 |
321 #undef CHECK_OK | 321 #undef CHECK_OK |
322 #undef CHECK_OK_CUSTOM | 322 #undef CHECK_OK_CUSTOM |
323 | 323 |
324 | 324 |
325 } // namespace internal | 325 } // namespace internal |
326 } // namespace v8 | 326 } // namespace v8 |
OLD | NEW |