1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-22 18:02:06 +00:00

LibCpp: Fix positional information of Pointer types

This commit is contained in:
Itamar 2021-07-03 11:34:18 +03:00 committed by Andreas Kling
parent 1dfdfcf820
commit 9a31fb6673
3 changed files with 8 additions and 8 deletions

View file

@ -1189,7 +1189,7 @@ NonnullRefPtr<Type> Parser::parse_type(ASTNode& parent)
while (!eof() && peek().type() == Token::Type::Asterisk) { while (!eof() && peek().type() == Token::Type::Asterisk) {
type->set_end(position()); type->set_end(position());
auto asterisk = consume(); auto asterisk = consume();
auto ptr = create_ast_node<Pointer>(parent, asterisk.start(), asterisk.end()); auto ptr = create_ast_node<Pointer>(parent, type->start(), asterisk.end());
type->set_parent(*ptr); type->set_parent(*ptr);
ptr->m_pointee = type; ptr->m_pointee = type;
ptr->set_end(position()); ptr->set_end(position());

View file

@ -67,10 +67,10 @@ TranslationUnit[0:0->144:0]
argc argc
NamedType[12:9->12:13] NamedType[12:9->12:13]
int int
Parameter[12:24->12:29] Parameter[12:19->12:29]
argv argv
Pointer[12:24->12:26] Pointer[12:19->12:26]
Pointer[12:23->12:24] Pointer[12:19->12:24]
NamedType[12:19->12:23] NamedType[12:19->12:23]
char char
) )
@ -103,7 +103,7 @@ TranslationUnit[0:0->144:0]
Vector<[const] char*> Vector<[const] char*>
child_argv child_argv
VariableDeclaration[21:4->21:41] VariableDeclaration[21:4->21:41]
Pointer[21:14->21:16] Pointer[21:4->21:16]
NamedType[21:4->21:14] NamedType[21:4->21:14]
[const] char [const] char
output_filename output_filename
@ -382,8 +382,8 @@ TranslationUnit[0:0->144:0]
CppCastExpression[66:48->66:85] CppCastExpression[66:48->66:85]
const_cast const_cast
< <
Pointer[66:64->66:65] Pointer[66:59->66:65]
Pointer[66:63->66:64] Pointer[66:59->66:64]
NamedType[66:59->66:63] NamedType[66:59->66:63]
char char
> >

View file

@ -6,7 +6,7 @@ TranslationUnit[1:0->12:0]
int int
x x
VariableDeclaration[4:4->5:0] VariableDeclaration[4:4->5:0]
Pointer[4:12->4:14] Pointer[4:4->4:14]
NamedType[4:4->4:12] NamedType[4:4->4:12]
s s
next next