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 3992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4003 expected_property_count = function_state.expected_property_count(); | 4003 expected_property_count = function_state.expected_property_count(); |
4004 if (use_temp_zone) { | 4004 if (use_temp_zone) { |
4005 // If the preconditions are correct the function body should never be | 4005 // If the preconditions are correct the function body should never be |
4006 // accessed, but do this anyway for better behaviour if they're wrong. | 4006 // accessed, but do this anyway for better behaviour if they're wrong. |
4007 body = nullptr; | 4007 body = nullptr; |
4008 } | 4008 } |
4009 } | 4009 } |
4010 | 4010 |
4011 // Parsing the body may change the language mode in our scope. | 4011 // Parsing the body may change the language mode in our scope. |
4012 language_mode = scope->language_mode(); | 4012 language_mode = scope->language_mode(); |
4013 scope->DeclareArguments(ast_value_factory()); | |
4014 if (main_scope != scope) { | |
4015 main_scope->DeclareArguments(ast_value_factory()); | |
4016 } | |
4017 | 4013 |
4018 // Validate name and parameter names. We can do this only after parsing the | 4014 // Validate name and parameter names. We can do this only after parsing the |
4019 // function, since the function can declare itself strict. | 4015 // function, since the function can declare itself strict. |
4020 CheckFunctionName(language_mode, function_name, function_name_validity, | 4016 CheckFunctionName(language_mode, function_name, function_name_validity, |
4021 function_name_location, CHECK_OK); | 4017 function_name_location, CHECK_OK); |
4022 const bool allow_duplicate_parameters = | 4018 const bool allow_duplicate_parameters = |
4023 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); | 4019 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); |
4024 ValidateFormalParameters(&formals_classifier, language_mode, | 4020 ValidateFormalParameters(&formals_classifier, language_mode, |
4025 allow_duplicate_parameters, CHECK_OK); | 4021 allow_duplicate_parameters, CHECK_OK); |
4026 | 4022 |
(...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6652 node->Print(Isolate::Current()); | 6648 node->Print(Isolate::Current()); |
6653 } | 6649 } |
6654 #endif // DEBUG | 6650 #endif // DEBUG |
6655 | 6651 |
6656 #undef CHECK_OK | 6652 #undef CHECK_OK |
6657 #undef CHECK_OK_VOID | 6653 #undef CHECK_OK_VOID |
6658 #undef CHECK_FAILED | 6654 #undef CHECK_FAILED |
6659 | 6655 |
6660 } // namespace internal | 6656 } // namespace internal |
6661 } // namespace v8 | 6657 } // namespace v8 |
OLD | NEW |