Add AST Node IdentifierPath

This commit is contained in:
Mathias Baumann
2020-10-13 14:32:11 +02:00
parent 0ea4bdafcd
commit 0b7b174945
33 changed files with 797 additions and 392 deletions
+10 -2
View File
@@ -939,6 +939,14 @@ ASTPointer<Identifier> Parser::parseIdentifier()
}
ASTPointer<UserDefinedTypeName> Parser::parseUserDefinedTypeName()
{
ASTNodeFactory nodeFactory(*this);
ASTPointer<IdentifierPath> identifierPath = parseIdentifierPath();
nodeFactory.setEndPositionFromNode(identifierPath);
return nodeFactory.createNode<UserDefinedTypeName>(identifierPath);
}
ASTPointer<IdentifierPath> Parser::parseIdentifierPath()
{
RecursionGuard recursionGuard(*this);
ASTNodeFactory nodeFactory(*this);
@@ -950,7 +958,7 @@ ASTPointer<UserDefinedTypeName> Parser::parseUserDefinedTypeName()
nodeFactory.markEndPosition();
identifierPath.push_back(*expectIdentifierToken());
}
return nodeFactory.createNode<UserDefinedTypeName>(identifierPath);
return nodeFactory.createNode<IdentifierPath>(identifierPath);
}
ASTPointer<TypeName> Parser::parseTypeNameSuffix(ASTPointer<TypeName> type, ASTNodeFactory& nodeFactory)
@@ -2101,7 +2109,7 @@ ASTPointer<TypeName> Parser::typeNameFromIndexAccessStructure(Parser::IndexAcces
vector<ASTString> path;
for (auto const& el: _iap.path)
path.push_back(dynamic_cast<Identifier const&>(*el).name());
type = nodeFactory.createNode<UserDefinedTypeName>(path);
type = nodeFactory.createNode<UserDefinedTypeName>(nodeFactory.createNode<IdentifierPath>(path));
}
for (auto const& lengthExpression: _iap.indices)
{