1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:27:45 +00:00

LibJS: Move AST node stack from VM to Interpreter

This commit is contained in:
Andreas Kling 2021-03-21 12:18:56 +01:00
parent b3b8c01ebf
commit 1603623772
7 changed files with 29 additions and 19 deletions

View file

@ -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;