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

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

Issue 2133543003: [parser] report errors for invalid binding patterns in async formal parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixup Created 4 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/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')
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_PARSING_EXPRESSION_CLASSIFIER_H 5 #ifndef V8_PARSING_EXPRESSION_CLASSIFIER_H
6 #define V8_PARSING_EXPRESSION_CLASSIFIER_H 6 #define V8_PARSING_EXPRESSION_CLASSIFIER_H
7 7
8 #include "src/messages.h" 8 #include "src/messages.h"
9 #include "src/parsing/scanner.h" 9 #include "src/parsing/scanner.h"
10 #include "src/parsing/token.h" 10 #include "src/parsing/token.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 243 }
244 244
245 void RecordBindingPatternError(const Scanner::Location& loc, 245 void RecordBindingPatternError(const Scanner::Location& loc,
246 MessageTemplate::Template message, 246 MessageTemplate::Template message,
247 const char* arg = nullptr) { 247 const char* arg = nullptr) {
248 if (!is_valid_binding_pattern()) return; 248 if (!is_valid_binding_pattern()) return;
249 invalid_productions_ |= BindingPatternProduction; 249 invalid_productions_ |= BindingPatternProduction;
250 Add(Error(loc, message, kBindingPatternProduction, arg)); 250 Add(Error(loc, message, kBindingPatternProduction, arg));
251 } 251 }
252 252
253 void ReplaceBindingPatternError(const Scanner::Location& loc,
254 MessageTemplate::Template message,
255 const char* arg = nullptr) {
256 if (!is_valid_binding_pattern()) {
257 Error& e = reported_error(kBindingPatternProduction);
258 e.location = loc;
259 e.message = message;
260 e.arg = arg;
261 } else {
262 RecordBindingPatternError(loc, message, arg);
263 }
264 }
265
253 void RecordAssignmentPatternError(const Scanner::Location& loc, 266 void RecordAssignmentPatternError(const Scanner::Location& loc,
254 MessageTemplate::Template message, 267 MessageTemplate::Template message,
255 const char* arg = nullptr) { 268 const char* arg = nullptr) {
256 if (!is_valid_assignment_pattern()) return; 269 if (!is_valid_assignment_pattern()) return;
257 invalid_productions_ |= AssignmentPatternProduction; 270 invalid_productions_ |= AssignmentPatternProduction;
258 Add(Error(loc, message, kAssignmentPatternProduction, arg)); 271 Add(Error(loc, message, kAssignmentPatternProduction, arg));
259 } 272 }
260 273
261 void RecordPatternError(const Scanner::Location& loc, 274 void RecordPatternError(const Scanner::Location& loc,
262 MessageTemplate::Template message, 275 MessageTemplate::Template message,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 }; 507 };
495 508
496 509
497 #undef ERROR_CODES 510 #undef ERROR_CODES
498 511
499 512
500 } // namespace internal 513 } // namespace internal
501 } // namespace v8 514 } // namespace v8
502 515
503 #endif // V8_PARSING_EXPRESSION_CLASSIFIER_H 516 #endif // V8_PARSING_EXPRESSION_CLASSIFIER_H
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698