1
0
mirror of synced 2025-01-18 17:14:13 +01:00

Disallow using declarations with invalid or not yet declared types

This commit is contained in:
WerWolv 2020-11-17 02:32:32 +01:00
parent 4c07983834
commit a2fb9306c7

View File

@ -1,4 +1,4 @@
#include "parser/validator.hpp"
#include "lang/validator.hpp"
#include <unordered_set>
#include <string>
@ -29,6 +29,9 @@ namespace hex::lang {
auto typeDeclNode = static_cast<ASTNodeTypeDecl*>(node);
if (!typeNames.insert(typeDeclNode->getTypeName()).second)
return false;
if (typeDeclNode->getAssignedType() == Token::TypeToken::Type::CustomType && !typeNames.contains(typeDeclNode->getAssignedCustomTypeName()))
return false;
}
break;
case ASTNode::Type::Struct: