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

Unified Diff: src/ast.cc

Issue 19539: Irregexp: Added derived knowledge of whether we are at the start of input. (Closed)
Patch Set: Fixed lint issues. Created 11 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
« no previous file with comments | « src/ast.h ('k') | src/flags.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index a5f4dc80a18046b0a382566463bc01a24523548c..3197aa90eabcb25b1a1bd90b7f2b99db772096bc 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -250,7 +250,13 @@ bool RegExpAssertion::IsAnchored() {
bool RegExpAlternative::IsAnchored() {
- return this->nodes()->at(0)->IsAnchored();
+ ZoneList<RegExpTree*>* nodes = this->nodes();
+ for (int i = 0; i < nodes->length(); i++) {
+ RegExpTree* node = nodes->at(i);
+ if (node->IsAnchored()) { return true; }
+ if (node->max_match() > 0) { return false; }
+ }
+ return false;
}
« no previous file with comments | « src/ast.h ('k') | src/flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698