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

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

Issue 2551633002: Change error messages for octal escape sequences (Closed)
Patch Set: Created 4 years 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/messages.h ('k') | 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 3dab585dcdbdbbd906a6952549c7cb75d9fe6317..5e6ef7b2b8fcaa222630b42b2d404047787dab64 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -869,11 +869,14 @@ class ParserBase {
// Checks whether an octal literal was last seen between beg_pos and end_pos.
// If so, reports an error. Only called for strict mode and template strings.
- void CheckOctalLiteral(int beg_pos, int end_pos,
- MessageTemplate::Template message, bool* ok) {
+ void CheckOctalLiteral(int beg_pos, int end_pos, bool is_template, bool* ok) {
Scanner::Location octal = scanner()->octal_position();
if (octal.IsValid() && beg_pos <= octal.beg_pos &&
octal.end_pos <= end_pos) {
+ MessageTemplate::Template message =
+ is_template ? MessageTemplate::kTemplateOctalLiteral
+ : scanner()->octal_message();
+ DCHECK_NE(message, MessageTemplate::kNone);
impl()->ReportMessageAt(octal, message);
scanner()->clear_octal_position();
*ok = false;
@@ -891,13 +894,11 @@ class ParserBase {
}
inline void CheckStrictOctalLiteral(int beg_pos, int end_pos, bool* ok) {
- CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kStrictOctalLiteral,
- ok);
+ CheckOctalLiteral(beg_pos, end_pos, false, ok);
}
inline void CheckTemplateOctalLiteral(int beg_pos, int end_pos, bool* ok) {
- CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kTemplateOctalLiteral,
- ok);
+ CheckOctalLiteral(beg_pos, end_pos, true, ok);
}
void CheckDestructuringElement(ExpressionT element, int beg_pos, int end_pos);
« no previous file with comments | « src/messages.h ('k') | src/parsing/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698