1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

LibCpp: Differentiate between Type and NamedType

This adds a new ASTNode type called 'NamedType' which inherits from
the Type node.

Previously every Type node had a name field, but it was not logically
accurate. For example, pointer types do not have a name
(the pointed-to type may have one).
This commit is contained in:
Itamar 2021-06-26 15:34:23 +03:00 committed by Ali Mohammad Pur
parent 10cad8a874
commit d7aa831a43
5 changed files with 55 additions and 29 deletions

View file

@ -86,6 +86,7 @@ private:
bool match_sizeof_expression();
bool match_braced_init_list();
bool match_type();
bool match_named_type();
bool match_access_specifier();
bool match_constructor(const StringView& class_name);
bool match_destructor(const StringView& class_name);
@ -111,6 +112,7 @@ private:
NonnullRefPtr<UnaryExpression> parse_unary_expression(ASTNode& parent);
NonnullRefPtr<BooleanLiteral> parse_boolean_literal(ASTNode& parent);
NonnullRefPtr<Type> parse_type(ASTNode& parent);
NonnullRefPtr<NamedType> parse_named_type(ASTNode& parent);
NonnullRefPtr<BinaryExpression> parse_binary_expression(ASTNode& parent, NonnullRefPtr<Expression> lhs, BinaryOp);
NonnullRefPtr<AssignmentExpression> parse_assignment_expression(ASTNode& parent, NonnullRefPtr<Expression> lhs, AssignmentOp);
NonnullRefPtr<ForStatement> parse_for_statement(ASTNode& parent);