summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCpp/Parser.h
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-06-26 15:34:23 +0300
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-29 00:07:19 +0430
commitd7aa831a430800ed5ce16b00a0cdcc72e434eeba (patch)
tree0662f876f8dc199b2d6f0ce783d55232e839ca1f /Userland/Libraries/LibCpp/Parser.h
parent10cad8a87418a4507b5385d69f66eef349b0561d (diff)
downloadserenity-d7aa831a430800ed5ce16b00a0cdcc72e434eeba.zip
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).
Diffstat (limited to 'Userland/Libraries/LibCpp/Parser.h')
-rw-r--r--Userland/Libraries/LibCpp/Parser.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCpp/Parser.h b/Userland/Libraries/LibCpp/Parser.h
index 8409144241..63b8e5278c 100644
--- a/Userland/Libraries/LibCpp/Parser.h
+++ b/Userland/Libraries/LibCpp/Parser.h
@@ -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);