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 4001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4012 expected_property_count = function_state.expected_property_count(); | 4012 expected_property_count = function_state.expected_property_count(); |
4013 if (use_temp_zone) { | 4013 if (use_temp_zone) { |
4014 // If the preconditions are correct the function body should never be | 4014 // If the preconditions are correct the function body should never be |
4015 // accessed, but do this anyway for better behaviour if they're wrong. | 4015 // accessed, but do this anyway for better behaviour if they're wrong. |
4016 body = nullptr; | 4016 body = nullptr; |
4017 } | 4017 } |
4018 } | 4018 } |
4019 | 4019 |
4020 // Parsing the body may change the language mode in our scope. | 4020 // Parsing the body may change the language mode in our scope. |
4021 language_mode = scope->language_mode(); | 4021 language_mode = scope->language_mode(); |
| 4022 scope->DeclareArguments(ast_value_factory()); |
| 4023 if (main_scope != scope) { |
| 4024 main_scope->DeclareArguments(ast_value_factory()); |
| 4025 } |
4022 | 4026 |
4023 // Validate name and parameter names. We can do this only after parsing the | 4027 // Validate name and parameter names. We can do this only after parsing the |
4024 // function, since the function can declare itself strict. | 4028 // function, since the function can declare itself strict. |
4025 CheckFunctionName(language_mode, function_name, function_name_validity, | 4029 CheckFunctionName(language_mode, function_name, function_name_validity, |
4026 function_name_location, CHECK_OK); | 4030 function_name_location, CHECK_OK); |
4027 const bool allow_duplicate_parameters = | 4031 const bool allow_duplicate_parameters = |
4028 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); | 4032 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); |
4029 ValidateFormalParameters(&formals_classifier, language_mode, | 4033 ValidateFormalParameters(&formals_classifier, language_mode, |
4030 allow_duplicate_parameters, CHECK_OK); | 4034 allow_duplicate_parameters, CHECK_OK); |
4031 | 4035 |
(...skipping 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6658 node->Print(Isolate::Current()); | 6662 node->Print(Isolate::Current()); |
6659 } | 6663 } |
6660 #endif // DEBUG | 6664 #endif // DEBUG |
6661 | 6665 |
6662 #undef CHECK_OK | 6666 #undef CHECK_OK |
6663 #undef CHECK_OK_VOID | 6667 #undef CHECK_OK_VOID |
6664 #undef CHECK_FAILED | 6668 #undef CHECK_FAILED |
6665 | 6669 |
6666 } // namespace internal | 6670 } // namespace internal |
6667 } // namespace v8 | 6671 } // namespace v8 |
OLD | NEW |