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

Unified Diff: src/parsing/scanner.h

Issue 2665513002: [parser] Lift template literal invalid escape restriction (Closed)
Patch Set: reintroduce DCHECK_EQ 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
« no previous file with comments | « src/parsing/preparser.h ('k') | src/parsing/scanner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/scanner.h
diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h
index 075b9ca6b2ba0c1d9468e7eef7e3598c85a5cd36..9885b8ed0a5b5c3988a79332527e1e327539c0a8 100644
--- a/src/parsing/scanner.h
+++ b/src/parsing/scanner.h
@@ -209,10 +209,27 @@ 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_; }
+ bool has_invalid_template_escape() const {
+ return invalid_template_escape_message_ != MessageTemplate::kNone;
+ }
+ MessageTemplate::Template invalid_template_escape_message() const {
+ return invalid_template_escape_message_;
+ }
+ Location invalid_template_escape_location() const {
+ return invalid_template_escape_location_;
+ }
+
+ void clear_invalid_template_escape() {
+ DCHECK(has_invalid_template_escape());
+ invalid_template_escape_message_ = MessageTemplate::kNone;
+ invalid_template_escape_location_ = Location::invalid();
+ }
+
// Similar functions for the upcoming token.
// One token look-ahead (past the token returned by Next()).
@@ -466,6 +483,7 @@ class Scanner {
next_next_.raw_literal_chars = NULL;
found_html_comment_ = false;
scanner_error_ = MessageTemplate::kNone;
+ invalid_template_escape_message_ = MessageTemplate::kNone;
}
void ReportScannerError(const Location& location,
@@ -756,6 +774,9 @@ class Scanner {
MessageTemplate::Template scanner_error_;
Location scanner_error_location_;
+
+ MessageTemplate::Template invalid_template_escape_message_;
+ Location invalid_template_escape_location_;
};
} // namespace internal
« no previous file with comments | « src/parsing/preparser.h ('k') | src/parsing/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698