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

Side by Side Diff: src/expression-classifier.h

Issue 1236863008: Improve error message for duplicate parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix webkit test Created 5 years, 5 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/messages.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #ifndef V8_EXPRESSION_CLASSIFIER_H 5 #ifndef V8_EXPRESSION_CLASSIFIER_H
6 #define V8_EXPRESSION_CLASSIFIER_H 6 #define V8_EXPRESSION_CLASSIFIER_H
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 invalid_productions_ |= ArrowFormalParametersProduction; 150 invalid_productions_ |= ArrowFormalParametersProduction;
151 arrow_formal_parameters_error_.location = loc; 151 arrow_formal_parameters_error_.location = loc;
152 arrow_formal_parameters_error_.message = message; 152 arrow_formal_parameters_error_.message = message;
153 arrow_formal_parameters_error_.arg = arg; 153 arrow_formal_parameters_error_.arg = arg;
154 } 154 }
155 155
156 void RecordDuplicateFormalParameterError(const Scanner::Location& loc) { 156 void RecordDuplicateFormalParameterError(const Scanner::Location& loc) {
157 if (!is_valid_formal_parameter_list_without_duplicates()) return; 157 if (!is_valid_formal_parameter_list_without_duplicates()) return;
158 invalid_productions_ |= DistinctFormalParametersProduction; 158 invalid_productions_ |= DistinctFormalParametersProduction;
159 duplicate_formal_parameter_error_.location = loc; 159 duplicate_formal_parameter_error_.location = loc;
160 duplicate_formal_parameter_error_.message = 160 duplicate_formal_parameter_error_.message = MessageTemplate::kParamDupe;
161 MessageTemplate::kStrictParamDupe;
162 duplicate_formal_parameter_error_.arg = nullptr; 161 duplicate_formal_parameter_error_.arg = nullptr;
163 } 162 }
164 163
165 // Record a binding that would be invalid in strict mode. Confusingly this 164 // Record a binding that would be invalid in strict mode. Confusingly this
166 // is not the same as StrictFormalParameterList, which simply forbids 165 // is not the same as StrictFormalParameterList, which simply forbids
167 // duplicate bindings. 166 // duplicate bindings.
168 void RecordStrictModeFormalParameterError(const Scanner::Location& loc, 167 void RecordStrictModeFormalParameterError(const Scanner::Location& loc,
169 MessageTemplate::Template message, 168 MessageTemplate::Template message,
170 const char* arg = nullptr) { 169 const char* arg = nullptr) {
171 if (!is_valid_strict_mode_formal_parameters()) return; 170 if (!is_valid_strict_mode_formal_parameters()) return;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 Error arrow_formal_parameters_error_; 245 Error arrow_formal_parameters_error_;
247 Error duplicate_formal_parameter_error_; 246 Error duplicate_formal_parameter_error_;
248 Error strict_mode_formal_parameter_error_; 247 Error strict_mode_formal_parameter_error_;
249 Error strong_mode_formal_parameter_error_; 248 Error strong_mode_formal_parameter_error_;
250 DuplicateFinder* duplicate_finder_; 249 DuplicateFinder* duplicate_finder_;
251 }; 250 };
252 } 251 }
253 } // v8::internal 252 } // v8::internal
254 253
255 #endif // V8_EXPRESSION_CLASSIFIER_H 254 #endif // V8_EXPRESSION_CLASSIFIER_H
OLDNEW
« no previous file with comments | « no previous file | src/messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698