diff options
author | Andreas Kling <kling@serenityos.org> | 2020-04-04 21:32:10 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-04 21:32:10 +0200 |
commit | 9691286cf00ad2f8f501f0bae4b0f3cd0cfaaca8 (patch) | |
tree | bf4b653d75f01b828dce7f9520ef80d804a33ef0 /Libraries/LibJS | |
parent | f8393b80e302b80b20198ea53b3c29342faf4003 (diff) | |
download | serenity-9691286cf00ad2f8f501f0bae4b0f3cd0cfaaca8.zip |
LibJS: Add Declaration class to the AST
This is just here to make the AST class hierarchy more spec-like.
Diffstat (limited to 'Libraries/LibJS')
-rw-r--r-- | Libraries/LibJS/AST.h | 7 |
1 files 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<Identifier> name, RefPtr<Expression> initializer, DeclarationType declaration_type) : m_declaration_type(declaration_type) |