Disallow using declarations with invalid or not yet declared types
This commit is contained in:
parent
4c07983834
commit
a2fb9306c7
@ -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:
|
Loading…
x
Reference in New Issue
Block a user