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

Unified Diff: src/scanner.h

Issue 615813004: Allow escape sequences in Constructor/Prototype tokens in PreParserTraits::GetSymbol() (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Share code between LiteralMatches() and UnescapedLiteralMatches() Created 6 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
Index: src/scanner.h
diff --git a/src/scanner.h b/src/scanner.h
index 356c8e4a549b0e41b753ab95db4891f164e0bc3d..a4387c03fa07f6859bcf43de3ba3b98db08ab5ac 100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -384,16 +384,24 @@ class Scanner {
const AstRawString* NextSymbol(AstValueFactory* ast_value_factory);
double DoubleValue();
- bool UnescapedLiteralMatches(const char* data, int length) {
+ bool LiteralMatches(const char* data, int length, bool allow_escapes) {
arv (Not doing code reviews) 2014/10/01 21:47:01 You can use default params here: bool allow_escap
if (is_literal_one_byte() &&
literal_length() == length &&
- !literal_contains_escapes()) {
+ (allow_escapes || !literal_contains_escapes())) {
const char* token =
reinterpret_cast<const char*>(literal_one_byte_string().start());
return !strncmp(token, data, length);
}
return false;
}
+ inline bool UnescapedLiteralMatches(const char* data, int length) {
+ return LiteralMatches(data, length, false);
+ }
+
+ inline bool LiteralMatches(const char* data, int length) {
arv (Not doing code reviews) 2014/10/01 21:47:01 Then this can be removed
+ return LiteralMatches(data, length, true);
+ }
+
void IsGetOrSet(bool* is_get, bool* is_set) {
if (is_literal_one_byte() &&
literal_length() == 3 &&
« no previous file with comments | « src/preparser.cc ('k') | test/cctest/test-parsing.cc » ('j') | test/cctest/test-parsing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698