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

Side by Side Diff: src/parser.cc

Issue 1083953002: Fix FormalParameterErrorLocations member names (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 5 years, 8 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 3702 matching lines...) Expand 10 before | Expand all | Expand 10 after
3713 const AstRawString* raw_name = proxy->raw_name(); 3713 const AstRawString* raw_name = proxy->raw_name();
3714 Scanner::Location param_location(proxy->position(), 3714 Scanner::Location param_location(proxy->position(),
3715 proxy->position() + raw_name->length()); 3715 proxy->position() + raw_name->length());
3716 3716
3717 if (proxy->is_this()) { 3717 if (proxy->is_this()) {
3718 ReportMessageAt(param_location, "this_formal_parameter"); 3718 ReportMessageAt(param_location, "this_formal_parameter");
3719 *ok = false; 3719 *ok = false;
3720 return; 3720 return;
3721 } 3721 }
3722 3722
3723 if (!error_locs->eval_or_arguments_.IsValid() && IsEvalOrArguments(raw_name)) 3723 if (!error_locs->eval_or_arguments.IsValid() && IsEvalOrArguments(raw_name))
3724 error_locs->eval_or_arguments_ = param_location; 3724 error_locs->eval_or_arguments = param_location;
3725 if (!error_locs->reserved_.IsValid() && IsFutureStrictReserved(raw_name)) 3725 if (!error_locs->reserved.IsValid() && IsFutureStrictReserved(raw_name))
3726 error_locs->reserved_ = param_location; 3726 error_locs->reserved = param_location;
3727 if (!error_locs->undefined_.IsValid() && IsUndefined(raw_name)) 3727 if (!error_locs->undefined.IsValid() && IsUndefined(raw_name))
3728 error_locs->undefined_ = param_location; 3728 error_locs->undefined = param_location;
3729 3729
3730 // TODO(wingo): Fix quadratic check. (Scope::IsDeclaredParameter has the same 3730 // TODO(wingo): Fix quadratic check. (Scope::IsDeclaredParameter has the same
3731 // issue.) 3731 // issue.)
3732 for (int i = 0; i < result->length(); i++) { 3732 for (int i = 0; i < result->length(); i++) {
3733 // Eagerly report the error here; duplicate formal parameter names are never 3733 // Eagerly report the error here; duplicate formal parameter names are never
3734 // allowed in arrow functions. 3734 // allowed in arrow functions.
3735 if (raw_name == result->at(i)) { 3735 if (raw_name == result->at(i)) {
3736 ReportMessageAt(param_location, 3736 ReportMessageAt(param_location,
3737 "duplicate_arrow_function_formal_parameter"); 3737 "duplicate_arrow_function_formal_parameter");
3738 *ok = false; 3738 *ok = false;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3948 ParseFormalParameterList(&error_locs, &has_rest, CHECK_OK); 3948 ParseFormalParameterList(&error_locs, &has_rest, CHECK_OK);
3949 Expect(Token::RPAREN, CHECK_OK); 3949 Expect(Token::RPAREN, CHECK_OK);
3950 int formals_end_position = scanner()->location().end_pos; 3950 int formals_end_position = scanner()->location().end_pos;
3951 3951
3952 CheckArityRestrictions(params->length(), arity_restriction, start_position, 3952 CheckArityRestrictions(params->length(), arity_restriction, start_position,
3953 formals_end_position, CHECK_OK); 3953 formals_end_position, CHECK_OK);
3954 3954
3955 scope->set_start_position(start_position); 3955 scope->set_start_position(start_position);
3956 3956
3957 num_parameters = DeclareFormalParameters(params, scope_, has_rest); 3957 num_parameters = DeclareFormalParameters(params, scope_, has_rest);
3958 if (error_locs.duplicate_.IsValid()) { 3958 if (error_locs.duplicate.IsValid()) {
3959 duplicate_parameters = FunctionLiteral::kHasDuplicateParameters; 3959 duplicate_parameters = FunctionLiteral::kHasDuplicateParameters;
3960 } 3960 }
3961 3961
3962 3962
3963 Expect(Token::LBRACE, CHECK_OK); 3963 Expect(Token::LBRACE, CHECK_OK);
3964 3964
3965 // If we have a named function expression, we add a local variable 3965 // If we have a named function expression, we add a local variable
3966 // declaration to the body of the function with the name of the 3966 // declaration to the body of the function with the name of the
3967 // function and let it refer to the function itself (closure). 3967 // function and let it refer to the function itself (closure).
3968 // NOTE: We create a proxy and resolve it here so that in the 3968 // NOTE: We create a proxy and resolve it here so that in the
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
5773 5773
5774 Expression* Parser::SpreadCallNew(Expression* function, 5774 Expression* Parser::SpreadCallNew(Expression* function,
5775 ZoneList<v8::internal::Expression*>* args, 5775 ZoneList<v8::internal::Expression*>* args,
5776 int pos) { 5776 int pos) {
5777 args->InsertAt(0, function, zone()); 5777 args->InsertAt(0, function, zone());
5778 5778
5779 return factory()->NewCallRuntime( 5779 return factory()->NewCallRuntime(
5780 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5780 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5781 } 5781 }
5782 } } // namespace v8::internal 5782 } } // 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