diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-21 12:18:56 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-21 16:02:11 +0100 |
commit | 1603623772c689665904880f437e402d11e1cd53 (patch) | |
tree | dad0281c0faa38b1b1efee3b4d0526b40e97ead7 /Userland/Libraries/LibJS/Interpreter.h | |
parent | b3b8c01ebfa1289c87c166be2c31337cec327abf (diff) | |
download | serenity-1603623772c689665904880f437e402d11e1cd53.zip |
LibJS: Move AST node stack from VM to Interpreter
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; |