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

Unified Diff: src/parsing/scanner.h

Issue 2665513002: [parser] Lift template literal invalid escape restriction (Closed)
Patch Set: rebase harder Created 3 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 side-by-side diff with in-line comments
Download patch
Index: src/parsing/scanner.h
diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h
index 075b9ca6b2ba0c1d9468e7eef7e3598c85a5cd36..a2996e420a1c3fe8908cfd316bad4564f3a19ffe 100644
--- a/src/parsing/scanner.h
+++ b/src/parsing/scanner.h
@@ -209,10 +209,17 @@ class Scanner {
// (the token last returned by Next()).
Location location() const { return current_.location; }
+ // This error is specifically an invalid hex or unicode escape sequence.
bool has_error() const { return scanner_error_ != MessageTemplate::kNone; }
MessageTemplate::Template error() const { return scanner_error_; }
Location error_location() const { return scanner_error_location_; }
+ void clear_error() {
+ DCHECK(has_error());
+ scanner_error_ = MessageTemplate::kNone;
+ scanner_error_location_ = Location();
+ }
+
// Similar functions for the upcoming token.
// One token look-ahead (past the token returned by Next()).

Powered by Google App Engine
This is Rietveld 408576698