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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 is_sloppy(function_scope->language_mode()) && formals.is_simple && | 155 is_sloppy(function_scope->language_mode()) && formals.is_simple && |
156 !IsConciseMethod(kind); | 156 !IsConciseMethod(kind); |
157 ValidateFormalParameters(function_scope->language_mode(), | 157 ValidateFormalParameters(function_scope->language_mode(), |
158 allow_duplicate_parameters, | 158 allow_duplicate_parameters, |
159 CHECK_OK_VALUE(kPreParseSuccess)); | 159 CHECK_OK_VALUE(kPreParseSuccess)); |
160 } | 160 } |
161 | 161 |
162 if (is_strict(function_scope->language_mode())) { | 162 if (is_strict(function_scope->language_mode())) { |
163 int end_pos = scanner()->location().end_pos; | 163 int end_pos = scanner()->location().end_pos; |
164 CheckStrictOctalLiteral(function_scope->start_position(), end_pos, ok); | 164 CheckStrictOctalLiteral(function_scope->start_position(), end_pos, ok); |
165 CheckDecimalLiteralWithLeadingZero(function_scope->start_position(), | |
166 end_pos); | |
167 } | 165 } |
168 } | 166 } |
169 return kPreParseSuccess; | 167 return kPreParseSuccess; |
170 } | 168 } |
171 | 169 |
172 | 170 |
173 // Preparsing checks a JavaScript program and emits preparse-data that helps | 171 // Preparsing checks a JavaScript program and emits preparse-data that helps |
174 // a later parsing to be faster. | 172 // a later parsing to be faster. |
175 // See preparser-data.h for the data. | 173 // See preparser-data.h for the data. |
176 | 174 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // function, since the function can declare itself strict. | 228 // function, since the function can declare itself strict. |
231 CheckFunctionName(language_mode, function_name, function_name_validity, | 229 CheckFunctionName(language_mode, function_name, function_name_validity, |
232 function_name_location, CHECK_OK); | 230 function_name_location, CHECK_OK); |
233 const bool allow_duplicate_parameters = | 231 const bool allow_duplicate_parameters = |
234 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); | 232 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); |
235 ValidateFormalParameters(language_mode, allow_duplicate_parameters, CHECK_OK); | 233 ValidateFormalParameters(language_mode, allow_duplicate_parameters, CHECK_OK); |
236 | 234 |
237 int end_position = scanner()->location().end_pos; | 235 int end_position = scanner()->location().end_pos; |
238 if (is_strict(language_mode)) { | 236 if (is_strict(language_mode)) { |
239 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK); | 237 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK); |
240 CheckDecimalLiteralWithLeadingZero(start_position, end_position); | |
241 } | 238 } |
242 function_scope->set_end_position(end_position); | 239 function_scope->set_end_position(end_position); |
243 | 240 |
244 if (FLAG_trace_preparse) { | 241 if (FLAG_trace_preparse) { |
245 PrintF(" [%s]: %i-%i\n", | 242 PrintF(" [%s]: %i-%i\n", |
246 track_unresolved_variables_ ? "Preparse resolution" | 243 track_unresolved_variables_ ? "Preparse resolution" |
247 : "Preparse no-resolution", | 244 : "Preparse no-resolution", |
248 function_scope->start_position(), function_scope->end_position()); | 245 function_scope->start_position(), function_scope->end_position()); |
249 } | 246 } |
250 | 247 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } | 315 } |
319 } | 316 } |
320 } | 317 } |
321 | 318 |
322 #undef CHECK_OK | 319 #undef CHECK_OK |
323 #undef CHECK_OK_CUSTOM | 320 #undef CHECK_OK_CUSTOM |
324 | 321 |
325 | 322 |
326 } // namespace internal | 323 } // namespace internal |
327 } // namespace v8 | 324 } // namespace v8 |
OLD | NEW |