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

Unified Diff: src/scanner-base.h

Issue 6382006: Strict mode parameter validation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Kevin's feedback Created 9 years, 11 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-base.h
diff --git a/src/scanner-base.h b/src/scanner-base.h
index 1024ad18582e3c078793d2295fe3cb8a92d23b18..96145b9c2dbd4420a0ecfc25a68960823a511385 100644
--- a/src/scanner-base.h
+++ b/src/scanner-base.h
@@ -271,10 +271,19 @@ class Scanner {
struct Location {
Location(int b, int e) : beg_pos(b), end_pos(e) { }
Location() : beg_pos(0), end_pos(0) { }
+
+ bool IsValid() const {
+ return beg_pos >= 0 && end_pos >= 0;
Lasse Reichstein 2011/01/25 13:03:55 How about ... && end_pos >= beg_pos; Seems more "v
Martin Maly 2011/01/25 17:21:25 Done. Using beg_pos >= 0 && end_pos >= beg_pos be
+ }
+
int beg_pos;
int end_pos;
};
+ static Location NoLocation() {
+ return Location(-1, -1);
+ }
+
// Returns the location information for the current token
// (the token returned by Next()).
Location location() const { return current_.location; }

Powered by Google App Engine
This is Rietveld 408576698