From a2fb9306c7f3b5f2f0a4e00a0daf34bd9ce639f6 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 17 Nov 2020 02:32:32 +0100 Subject: [PATCH] Disallow using declarations with invalid or not yet declared types --- source/{parser => lang}/validator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) rename source/{parser => lang}/validator.cpp (91%) diff --git a/source/parser/validator.cpp b/source/lang/validator.cpp similarity index 91% rename from source/parser/validator.cpp rename to source/lang/validator.cpp index 585603979..6760b2704 100644 --- a/source/parser/validator.cpp +++ b/source/lang/validator.cpp @@ -1,4 +1,4 @@ -#include "parser/validator.hpp" +#include "lang/validator.hpp" #include #include @@ -29,6 +29,9 @@ namespace hex::lang { auto typeDeclNode = static_cast(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: