From 9691286cf00ad2f8f501f0bae4b0f3cd0cfaaca8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 4 Apr 2020 21:32:10 +0200 Subject: [PATCH] LibJS: Add Declaration class to the AST This is just here to make the AST class hierarchy more spec-like. --- Libraries/LibJS/AST.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Libraries/LibJS/AST.h b/Libraries/LibJS/AST.h index 6f6d7eec59..cfd6d06aa8 100644 --- a/Libraries/LibJS/AST.h +++ b/Libraries/LibJS/AST.h @@ -131,6 +131,9 @@ private: class Expression : public ASTNode { }; +class Declaration : public Statement { +}; + class FunctionNode { public: const FlyString& name() const { return m_name; } @@ -154,7 +157,7 @@ private: }; class FunctionDeclaration final - : public Statement + : public Declaration , public FunctionNode { public: static bool must_have_name() { return true; } @@ -576,7 +579,7 @@ enum class DeclarationType { Const, }; -class VariableDeclaration : public Statement { +class VariableDeclaration : public Declaration { public: VariableDeclaration(NonnullRefPtr name, RefPtr initializer, DeclarationType declaration_type) : m_declaration_type(declaration_type)