Browse Source

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.
Andreas Kling 4 years ago
parent
commit
941be2dcc2

+ 1 - 0
Userland/Libraries/LibJS/AST.h

@@ -997,6 +997,7 @@ public:
 
 
     virtual Value execute(Interpreter&, GlobalObject&) const override;
     virtual Value execute(Interpreter&, GlobalObject&) const override;
     virtual void dump(int indent) const override;
     virtual void dump(int indent) const override;
+    virtual void generate_bytecode(Bytecode::Generator&) const override;
 
 
     const NonnullRefPtrVector<VariableDeclarator>& declarations() const { return m_declarations; }
     const NonnullRefPtrVector<VariableDeclarator>& declarations() const { return m_declarations; }
 
 

+ 4 - 0
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
 void CallExpression::generate_bytecode(Bytecode::Generator& generator) const
 {
 {
     m_callee->generate_bytecode(generator);
     m_callee->generate_bytecode(generator);