Index: src/ast/ast.h |
diff --git a/src/ast/ast.h b/src/ast/ast.h |
index b4f2992e047215ac95d2c61b96a98d64afbfb5a1..eae0bda0e10adfb472385b903390a500669bf311 100644 |
--- a/src/ast/ast.h |
+++ b/src/ast/ast.h |
@@ -3180,24 +3180,21 @@ class RegExpLookaround final : public RegExpTree { |
class RegExpBackReference final : public RegExpTree { |
public: |
explicit RegExpBackReference(RegExpCapture* capture) |
- : capture_(capture) { } |
+ : capture_(capture), max_match_(kUninitialized) {} |
void* Accept(RegExpVisitor* visitor, void* data) override; |
RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override; |
RegExpBackReference* AsBackReference() override; |
bool IsBackReference() override; |
int min_match() override { return 0; } |
- // The capture may not be completely parsed yet, if the reference occurs |
- // before the capture. In the ordinary case, nothing has been captured yet, |
- // so the back reference must have the length 0. If the back reference is |
- // inside a lookbehind, effectively making it a forward reference, we return |
- // 0 since lookbehinds have a length of 0. |
- int max_match() override { |
- return capture_->body() ? capture_->max_match() : 0; |
- } |
+ int max_match() override; |
int index() { return capture_->index(); } |
RegExpCapture* capture() { return capture_; } |
private: |
+ static const int kUninitialized = -1; |
+ static const int kRecursionMarker = -2; |
+ |
RegExpCapture* capture_; |
+ int max_match_; |
}; |