From 941be2dcc232c3d9ea1e909c8b21b311e29481e4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 10 Jun 2021 00:29:17 +0200 Subject: [PATCH] LibJS: Add empty bytecode generation for VariableDeclaration These will be partly handled by the relevant ScopeNode due to hoisting, same basic idea as function declarations. VariableDeclaration needs to do some work, but let's stub it out first and start empty. --- Userland/Libraries/LibJS/AST.h | 1 + Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Userland/Libraries/LibJS/AST.h b/Userland/Libraries/LibJS/AST.h index af4e1ca842..946a60feaa 100644 --- a/Userland/Libraries/LibJS/AST.h +++ b/Userland/Libraries/LibJS/AST.h @@ -997,6 +997,7 @@ public: virtual Value execute(Interpreter&, GlobalObject&) const override; virtual void dump(int indent) const override; + virtual void generate_bytecode(Bytecode::Generator&) const override; const NonnullRefPtrVector& declarations() const { return m_declarations; } diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 3910cd8e31..4c16903670 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -556,6 +556,10 @@ void FunctionDeclaration::generate_bytecode(Bytecode::Generator&) const { } +void VariableDeclaration::generate_bytecode(Bytecode::Generator&) const +{ +} + void CallExpression::generate_bytecode(Bytecode::Generator& generator) const { m_callee->generate_bytecode(generator);