mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
LibCpp: Introduce DummyASTNode
This allows us to use pase_* methods inside match_* methods, without adding any actual AST nodes to the m_nodes list.
This commit is contained in:
parent
aa717e6a62
commit
e16036b9cc
3 changed files with 38 additions and 16 deletions
|
@ -77,7 +77,8 @@ public:
|
|||
virtual bool is_function_call() const { return false; }
|
||||
virtual bool is_type() const { return false; }
|
||||
virtual bool is_declaration() const { return false; }
|
||||
virtual bool is_name() const {return false;}
|
||||
virtual bool is_name() const { return false; }
|
||||
virtual bool is_dummy_node() const { return false; }
|
||||
|
||||
protected:
|
||||
ASTNode(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename)
|
||||
|
@ -347,7 +348,7 @@ public:
|
|||
virtual ~Name() override = default;
|
||||
virtual const char* class_name() const override { return "Name"; }
|
||||
virtual void dump(size_t indent) const override;
|
||||
virtual bool is_name() const override {return true;}
|
||||
virtual bool is_name() const override { return true; }
|
||||
|
||||
Name(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename)
|
||||
: Expression(parent, start, end, filename)
|
||||
|
@ -756,4 +757,15 @@ public:
|
|||
|
||||
NonnullRefPtrVector<Expression> m_expressions;
|
||||
};
|
||||
|
||||
class DummyAstNode : public ASTNode {
|
||||
public:
|
||||
DummyAstNode(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename)
|
||||
: ASTNode(parent, start, end, filename)
|
||||
{
|
||||
}
|
||||
virtual bool is_dummy_node() const override { return true; }
|
||||
virtual const char* class_name() const override { return "DummyAstNode"; }
|
||||
virtual void dump(size_t) const override { }
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue