mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +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
Notes:
sideshowbarker
2024-07-19 07:55:54 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9691286cf00
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
Reference in a new issue