mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 02:28:12 +00:00
LibJS: Add Declaration class to the AST
This is just here to make the AST class hierarchy more spec-like.
This commit is contained in:
parent
f8393b80e3
commit
9691286cf0
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue