diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp index 1b2634c0..00063f26 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp @@ -48,6 +48,8 @@ void HeaderBlockStruct::OnOpen(HeaderParserState* state) { state->m_namespace.Push(m_type_name); } + + state->AddForwardDeclaration(std::make_unique(m_namespace, m_type_name, DataDefinitionType::STRUCT)); } void HeaderBlockStruct::OnClose(HeaderParserState* state) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp index a23fcd91..c83de8d2 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp @@ -48,6 +48,8 @@ void HeaderBlockUnion::OnOpen(HeaderParserState* state) { state->m_namespace.Push(m_type_name); } + + state->AddForwardDeclaration(std::make_unique(m_namespace, m_type_name, DataDefinitionType::UNION)); } void HeaderBlockUnion::OnClose(HeaderParserState* state) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.cpp index 93b4aeae..b4dbb7f8 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Impl/HeaderParserState.cpp @@ -61,7 +61,7 @@ void HeaderParserState::AddDataType(std::unique_ptr definition) void HeaderParserState::AddForwardDeclaration(std::unique_ptr forwardDeclaration) { - m_forward_declarations.insert(std::make_pair(forwardDeclaration->m_name, std::move(forwardDeclaration))); + m_forward_declarations.insert(std::make_pair(forwardDeclaration->GetFullName(), std::move(forwardDeclaration))); } const DataDefinition* HeaderParserState::FindType(const std::string& typeName)