| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2689 } | 2689 } |
| 2690 | 2690 |
| 2691 if (!is_lazy_top_level_function && !is_lazy_inner_function) { | 2691 if (!is_lazy_top_level_function && !is_lazy_inner_function) { |
| 2692 body = ParseEagerFunctionBody(function_name, pos, formals, kind, | 2692 body = ParseEagerFunctionBody(function_name, pos, formals, kind, |
| 2693 function_type, CHECK_OK); | 2693 function_type, CHECK_OK); |
| 2694 | 2694 |
| 2695 materialized_literal_count = function_state.materialized_literal_count(); | 2695 materialized_literal_count = function_state.materialized_literal_count(); |
| 2696 expected_property_count = function_state.expected_property_count(); | 2696 expected_property_count = function_state.expected_property_count(); |
| 2697 } | 2697 } |
| 2698 | 2698 |
| 2699 if (use_temp_zone || is_lazy_top_level_function) { | 2699 DCHECK(use_temp_zone || !is_lazy_top_level_function); |
| 2700 if (use_temp_zone) { |
| 2700 // If the preconditions are correct the function body should never be | 2701 // If the preconditions are correct the function body should never be |
| 2701 // accessed, but do this anyway for better behaviour if they're wrong. | 2702 // accessed, but do this anyway for better behaviour if they're wrong. |
| 2702 body = nullptr; | 2703 body = nullptr; |
| 2703 scope->AnalyzePartially(&previous_zone_ast_node_factory); | 2704 scope->AnalyzePartially(&previous_zone_ast_node_factory); |
| 2704 } | 2705 } |
| 2705 | 2706 |
| 2707 if (FLAG_trace_preparse) { |
| 2708 PrintF(" [%s]: %i-%i %.*s\n", |
| 2709 is_lazy_top_level_function |
| 2710 ? "Preparse no-resolution" |
| 2711 : (use_temp_zone ? "Preparse resolution" : "Full parse"), |
| 2712 scope->start_position(), scope->end_position(), |
| 2713 function_name->byte_length(), function_name->raw_data()); |
| 2714 } |
| 2715 |
| 2706 // Parsing the body may change the language mode in our scope. | 2716 // Parsing the body may change the language mode in our scope. |
| 2707 language_mode = scope->language_mode(); | 2717 language_mode = scope->language_mode(); |
| 2708 | 2718 |
| 2709 // Validate name and parameter names. We can do this only after parsing the | 2719 // Validate name and parameter names. We can do this only after parsing the |
| 2710 // function, since the function can declare itself strict. | 2720 // function, since the function can declare itself strict. |
| 2711 CheckFunctionName(language_mode, function_name, function_name_validity, | 2721 CheckFunctionName(language_mode, function_name, function_name_validity, |
| 2712 function_name_location, CHECK_OK); | 2722 function_name_location, CHECK_OK); |
| 2713 const bool allow_duplicate_parameters = | 2723 const bool allow_duplicate_parameters = |
| 2714 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); | 2724 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); |
| 2715 ValidateFormalParameters(language_mode, allow_duplicate_parameters, | 2725 ValidateFormalParameters(language_mode, allow_duplicate_parameters, |
| (...skipping 2682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5398 | 5408 |
| 5399 return final_loop; | 5409 return final_loop; |
| 5400 } | 5410 } |
| 5401 | 5411 |
| 5402 #undef CHECK_OK | 5412 #undef CHECK_OK |
| 5403 #undef CHECK_OK_VOID | 5413 #undef CHECK_OK_VOID |
| 5404 #undef CHECK_FAILED | 5414 #undef CHECK_FAILED |
| 5405 | 5415 |
| 5406 } // namespace internal | 5416 } // namespace internal |
| 5407 } // namespace v8 | 5417 } // namespace v8 |
| OLD | NEW |