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

Unified Diff: src/parsing/scanner.h

Issue 2366573002: [parser] Use Back2() where appropriate. (Closed)
Patch Set: Add comments. Created 4 years, 3 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.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 ff5ca32b9bb1aa32f8d9886777caba12e245f6d5..b2b1a8a3f48a348b5fb8c44591d571749a0ac98f 100644
--- a/src/parsing/scanner.h
+++ b/src/parsing/scanner.h
@@ -617,6 +617,15 @@ class Scanner {
c0_ = ch;
}
+ // Same as PushBack(ch1); PushBack(ch2).
+ // - Potentially more efficient as it uses Back2() on the stream.
+ // - Uses char as parameters, since we're only calling it with ASCII chars in
+ // practice. This way, we can avoid a few edge cases.
+ void PushBack2(char ch1, char ch2) {
+ source_->Back2();
+ c0_ = ch2;
+ }
+
inline Token::Value Select(Token::Value tok) {
Advance();
return tok;
« no previous file with comments | « no previous file | src/parsing/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698