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

Side by Side Diff: src/parser.cc

Issue 924403002: [parsing]: eval/arguments parameter names are ok in sloppy mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: test fix Created 5 years, 10 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 | « no previous file | src/preparser.h » ('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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 3684 matching lines...) Expand 10 before | Expand all | Expand 10 after
3695 const AstRawString* param_name = 3695 const AstRawString* param_name =
3696 ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK); 3696 ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK);
3697 3697
3698 // Store locations for possible future error reports. 3698 // Store locations for possible future error reports.
3699 if (!eval_args_error_loc.IsValid() && IsEvalOrArguments(param_name)) { 3699 if (!eval_args_error_loc.IsValid() && IsEvalOrArguments(param_name)) {
3700 eval_args_error_loc = scanner()->location(); 3700 eval_args_error_loc = scanner()->location();
3701 } 3701 }
3702 if (!reserved_error_loc.IsValid() && is_strict_reserved) { 3702 if (!reserved_error_loc.IsValid() && is_strict_reserved) {
3703 reserved_error_loc = scanner()->location(); 3703 reserved_error_loc = scanner()->location();
3704 } 3704 }
3705 if (!dupe_error_loc.IsValid() && scope_->IsDeclared(param_name)) { 3705 if (!dupe_error_loc.IsValid() &&
3706 scope_->IsDeclaredParameter(param_name)) {
3706 duplicate_parameters = FunctionLiteral::kHasDuplicateParameters; 3707 duplicate_parameters = FunctionLiteral::kHasDuplicateParameters;
3707 dupe_error_loc = scanner()->location(); 3708 dupe_error_loc = scanner()->location();
3708 } 3709 }
3709 3710
3710 Variable* var = scope_->DeclareParameter(param_name, VAR, is_rest); 3711 Variable* var = scope_->DeclareParameter(param_name, VAR, is_rest);
3711 if (is_sloppy(scope->language_mode())) { 3712 if (is_sloppy(scope->language_mode())) {
3712 // TODO(sigurds) Mark every parameter as maybe assigned. This is a 3713 // TODO(sigurds) Mark every parameter as maybe assigned. This is a
3713 // conservative approximation necessary to account for parameters 3714 // conservative approximation necessary to account for parameters
3714 // that are assigned via the arguments array. 3715 // that are assigned via the arguments array.
3715 var->set_maybe_assigned(); 3716 var->set_maybe_assigned();
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
5467 } else { 5468 } else {
5468 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); 5469 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data());
5469 running_hash = StringHasher::ComputeRunningHash(running_hash, data, 5470 running_hash = StringHasher::ComputeRunningHash(running_hash, data,
5470 raw_string->length()); 5471 raw_string->length());
5471 } 5472 }
5472 } 5473 }
5473 5474
5474 return running_hash; 5475 return running_hash;
5475 } 5476 }
5476 } } // namespace v8::internal 5477 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698