Index: src/parsing/parser.h |
diff --git a/src/parsing/parser.h b/src/parsing/parser.h |
index 00075f46e142303e0fc4c6cdfeda2d2d64ef90ad..19384f6fdba3581cc78d0c55a68ed2c1d5a98966 100644 |
--- a/src/parsing/parser.h |
+++ b/src/parsing/parser.h |
@@ -235,6 +235,22 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { |
original_scope_); |
} |
+ bool parse_lazily() const { return mode_ == PARSE_LAZILY; } |
+ enum Mode { PARSE_LAZILY, PARSE_EAGERLY }; |
+ |
+ class ParsingModeScope BASE_EMBEDDED { |
+ public: |
+ ParsingModeScope(Parser* parser, Mode mode) |
+ : parser_(parser), old_mode_(parser->mode_) { |
+ parser_->mode_ = mode; |
+ } |
+ ~ParsingModeScope() { parser_->mode_ = old_mode_; } |
+ |
+ private: |
+ Parser* parser_; |
+ Mode old_mode_; |
+ }; |
+ |
// Runtime encoding of different completion modes. |
enum CompletionKind { |
kNormalCompletion, |
@@ -1119,6 +1135,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { |
Scanner scanner_; |
PreParser* reusable_preparser_; |
Scope* original_scope_; // for ES5 function declarations in sloppy eval |
+ Mode mode_; |
friend class ParserTarget; |
friend class ParserTargetScope; |