Index: runtime/vm/parser.h |
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h |
index edc8fdfd01d88936f8e608bcffc5d97cf73729b1..9d9e50346ca2b5fac395f6ff8635c8f659cdc5fb 100644 |
--- a/runtime/vm/parser.h |
+++ b/runtime/vm/parser.h |
@@ -36,6 +36,7 @@ struct MemberDesc; |
struct ParamList; |
struct QualIdent; |
class TopLevel; |
+class RecursionChecker; |
// The class ParsedFunction holds the result of parsing a function. |
class ParsedFunction : public ZoneAllocated { |
@@ -365,6 +366,9 @@ class Parser : public ValueObject { |
const Function& constructor, |
const TypeArguments& type_arguments); |
+ // Report error if parsed code is too deeply nested; avoid stack overflow. |
+ void CheckStack(); |
+ |
// Report already formatted error. |
static void ReportError(const Error& error); |
@@ -894,6 +898,9 @@ class Parser : public ValueObject { |
// Indentation of parser trace. |
intptr_t trace_indent_; |
+ intptr_t recursion_counter_; |
+ friend class RecursionChecker; |
+ |
DISALLOW_COPY_AND_ASSIGN(Parser); |
}; |