Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/parsing/parser.cc

Issue 2290753003: Allow lexically declared "arguments" in function scope in sloppy mode. (Closed)
Patch Set: clang format Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/scopes.cc ('k') | test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
4013 4017
4014 // Validate name and parameter names. We can do this only after parsing the 4018 // Validate name and parameter names. We can do this only after parsing the
4015 // function, since the function can declare itself strict. 4019 // function, since the function can declare itself strict.
4016 CheckFunctionName(language_mode, function_name, function_name_validity, 4020 CheckFunctionName(language_mode, function_name, function_name_validity,
4017 function_name_location, CHECK_OK); 4021 function_name_location, CHECK_OK);
4018 const bool allow_duplicate_parameters = 4022 const bool allow_duplicate_parameters =
4019 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); 4023 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind);
4020 ValidateFormalParameters(&formals_classifier, language_mode, 4024 ValidateFormalParameters(&formals_classifier, language_mode,
4021 allow_duplicate_parameters, CHECK_OK); 4025 allow_duplicate_parameters, CHECK_OK);
4022 4026
(...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after
6648 node->Print(Isolate::Current()); 6652 node->Print(Isolate::Current());
6649 } 6653 }
6650 #endif // DEBUG 6654 #endif // DEBUG
6651 6655
6652 #undef CHECK_OK 6656 #undef CHECK_OK
6653 #undef CHECK_OK_VOID 6657 #undef CHECK_OK_VOID
6654 #undef CHECK_FAILED 6658 #undef CHECK_FAILED
6655 6659
6656 } // namespace internal 6660 } // namespace internal
6657 } // namespace v8 6661 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698