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

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

Issue 2510873005: A decimal integer literal with a leading 0 is now an error in strict mode. (Closed)
Patch Set: Created 4 years, 1 month 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/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 02df5cf392f01b432d8f972849d53eddb47d6917..24bd0296886db52ff5ef6e02e0c676eaf39e340a 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -854,35 +854,27 @@ 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_escape,
+ 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_escape ? MessageTemplate::kTemplateOctalLiteral
+ : scanner()->octal_message();
+ DCHECK_NE(message, MessageTemplate::kNone);
Dan Ehrenberg 2016/11/18 17:13:51 IMO it wouldn't hurt to continue updating the UseC
impl()->ReportMessageAt(octal, message);
scanner()->clear_octal_position();
*ok = false;
}
}
- // for now, this check just collects statistics.
- void CheckDecimalLiteralWithLeadingZero(int beg_pos, int end_pos) {
- Scanner::Location token_location =
- scanner()->decimal_with_leading_zero_position();
- if (token_location.IsValid() && beg_pos <= token_location.beg_pos &&
- token_location.end_pos <= end_pos) {
- scanner()->clear_decimal_with_leading_zero_position();
- impl()->CountUsage(v8::Isolate::kDecimalWithLeadingZeroInStrictMode);
- }
- }
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);
« src/messages.h ('K') | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698