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

Unified Diff: src/parsing/parser-base.h

Issue 2724003006: [parser] Correctly handle invalid escapes in adjacent template tokens. (Closed)
Patch Set: MoveErrorTo takes a TokenDesc* 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 | « no previous file | src/parsing/scanner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index aeae4ab1f02946c7bbfbee3116c1b9ff881375db..2ec49cf9414e6515f07276121d2042a266d0ed08 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -835,10 +835,12 @@ class ParserBase {
}
// Checks if an octal literal or an invalid hex or unicode escape sequence
- // appears in a template literal. In the presence of such, either
- // returns false or reports an error, depending on should_throw. Otherwise
- // returns true.
+ // appears in the current template literal token. In the presence of such,
+ // either returns false or reports an error, depending on should_throw.
+ // Otherwise returns true.
inline bool CheckTemplateEscapes(bool should_throw, bool* ok) {
+ DCHECK(scanner()->current_token() == Token::TEMPLATE_SPAN ||
+ scanner()->current_token() == Token::TEMPLATE_TAIL);
if (!scanner()->has_invalid_template_escape()) {
return true;
}
@@ -849,7 +851,6 @@ class ParserBase {
scanner()->invalid_template_escape_message());
*ok = false;
}
- scanner()->clear_invalid_template_escape();
return false;
}
« no previous file with comments | « no previous file | src/parsing/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698