diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Interpreter.h')
-rw-r--r-- | Userland/Libraries/LibJS/Interpreter.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Interpreter.h b/Userland/Libraries/LibJS/Interpreter.h index 5efb1428da..a2b801cefa 100644 --- a/Userland/Libraries/LibJS/Interpreter.h +++ b/Userland/Libraries/LibJS/Interpreter.h @@ -80,6 +80,12 @@ public: void enter_node(const ASTNode&); void exit_node(const ASTNode&); + void push_ast_node(const ASTNode& node) { m_ast_nodes.append(&node); } + void pop_ast_node() { m_ast_nodes.take_last(); } + + const ASTNode* current_node() const { return !m_ast_nodes.is_empty() ? m_ast_nodes.last() : nullptr; } + const Vector<const ASTNode*>& node_stack() const { return m_ast_nodes; } + Value execute_statement(GlobalObject&, const Statement&, ScopeType = ScopeType::Block); private: @@ -88,6 +94,7 @@ private: void push_scope(ScopeFrame frame); Vector<ScopeFrame> m_scope_stack; + Vector<const ASTNode*> m_ast_nodes; NonnullRefPtr<VM> m_vm; |