mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:17:35 +00:00
LibCpp: Parse templatized types
We can now parse things like Vector<int>
This commit is contained in:
parent
9954a1837f
commit
29b6915db9
4 changed files with 156 additions and 41 deletions
|
@ -215,10 +215,10 @@ public:
|
|||
const StringView& name() const { return m_name; }
|
||||
virtual void dump(size_t indent) const override;
|
||||
virtual bool is_type() const override { return true; }
|
||||
virtual bool is_templatized() const { return false; }
|
||||
|
||||
Type(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename, StringView name)
|
||||
Type(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename)
|
||||
: ASTNode(parent, start, end, filename)
|
||||
, m_name(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -226,6 +226,21 @@ public:
|
|||
Vector<StringView> m_qualifiers;
|
||||
};
|
||||
|
||||
class TemplatizedType : public Type {
|
||||
public:
|
||||
virtual ~TemplatizedType() override = default;
|
||||
virtual const char* class_name() const override { return "TemplatizedType"; }
|
||||
virtual void dump(size_t indent) const override;
|
||||
virtual bool is_templatized() const override { return true; }
|
||||
|
||||
TemplatizedType(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename)
|
||||
: Type(parent, start, end, filename)
|
||||
{
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Type> m_template_arguments;
|
||||
};
|
||||
|
||||
class Pointer : public Type {
|
||||
public:
|
||||
virtual ~Pointer() override = default;
|
||||
|
@ -233,7 +248,7 @@ public:
|
|||
virtual void dump(size_t indent) const override;
|
||||
|
||||
Pointer(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename)
|
||||
: Type(parent, start, end, filename, {})
|
||||
: Type(parent, start, end, filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue