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

Unified Diff: src/parser.cc

Issue 6927075: Strict mode detection in preparser. (Closed)
Patch Set: Added TODO with bugnumber for R Created 9 years, 7 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 | « src/parser.h ('k') | src/preparse-data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index f983437183b4acaf5c7d7ec67900ca2ed92d76f8..9e4031ad79f59d3b2e8e3d546d68aa7713e8721c 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -3543,9 +3543,9 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name,
// '(' (Identifier)*[','] ')'
Expect(Token::LPAREN, CHECK_OK);
start_pos = scanner().location().beg_pos;
- Scanner::Location name_loc = Scanner::NoLocation();
- Scanner::Location dupe_loc = Scanner::NoLocation();
- Scanner::Location reserved_loc = Scanner::NoLocation();
+ Scanner::Location name_loc = Scanner::Location::invalid();
+ Scanner::Location dupe_loc = Scanner::Location::invalid();
+ Scanner::Location reserved_loc = Scanner::Location::invalid();
bool done = (peek() == Token::RPAREN);
while (!done) {
@@ -3864,12 +3864,14 @@ void Parser::CheckStrictModeLValue(Expression* expression,
}
-// Checks whether octal literal last seen is between beg_pos and end_pos.
-// If so, reports an error.
+// Checks whether an octal literal was last seen between beg_pos and end_pos.
+// If so, reports an error. Only called for strict mode.
void Parser::CheckOctalLiteral(int beg_pos, int end_pos, bool* ok) {
- int octal = scanner().octal_position();
- if (beg_pos <= octal && octal <= end_pos) {
- ReportMessageAt(Scanner::Location(octal, octal + 1), "strict_octal_literal",
+ Scanner::Location octal = scanner().octal_position();
+ if (octal.IsValid() &&
+ beg_pos <= octal.beg_pos &&
+ octal.end_pos <= end_pos) {
+ ReportMessageAt(octal, "strict_octal_literal",
Vector<const char*>::empty());
scanner().clear_octal_position();
*ok = false;
« no previous file with comments | « src/parser.h ('k') | src/preparse-data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698