fix a few snippet conditions for zoneloading in zcg new

This commit is contained in:
Jan 2021-03-01 12:10:57 +01:00
parent 11eb9ae4ce
commit 602d263472

View File

@ -136,7 +136,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
{ {
LINE("*"<< MakeTypePtrVarName(def)<<" = m_stream->Alloc<"<<def->GetFullName()<<">(alignof("<<def->GetFullName()<<")); // "<<def->GetAlignment()) LINE("*"<< MakeTypePtrVarName(def)<<" = m_stream->Alloc<"<<def->GetFullName()<<">(alignof("<<def->GetFullName()<<")); // "<<def->GetAlignment())
if (info && info->m_is_leaf) if (info && !info->m_is_leaf)
{ {
LINE(MakeTypeVarName(info->m_definition)<<" = *"<< MakeTypePtrVarName(def)<<";") LINE(MakeTypeVarName(info->m_definition)<<" = *"<< MakeTypePtrVarName(def)<<";")
LINE("Load_"<< MakeSafeTypeName(def)<<"(true);") LINE("Load_"<< MakeSafeTypeName(def)<<"(true);")
@ -714,6 +714,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
if (member->m_type->m_post_load_action) if (member->m_type->m_post_load_action)
{ {
LINE("")
LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get())) LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get()))
} }
} }
@ -755,6 +756,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
if (member->m_type->m_post_load_action) if (member->m_type->m_post_load_action)
{ {
LINE("")
LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get())) LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get()))
} }
} }
@ -788,6 +790,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
if (member->m_type->m_post_load_action) if (member->m_type->m_post_load_action)
{ {
LINE("")
LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get())) LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get()))
} }
} }
@ -808,6 +811,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
if (member->m_type->m_post_load_action) if (member->m_type->m_post_load_action)
{ {
LINE("")
LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get())) LINE(MakeCustomActionCall(member->m_type->m_post_load_action.get()))
} }
} }
@ -876,9 +880,14 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
return false; return false;
} }
if(loadType == MemberLoadType::POINTER_ARRAY)
{
return !modifier.IsArray();
}
if (member->m_is_string) if (member->m_is_string)
{ {
return loadType == MemberLoadType::POINTER_ARRAY && !modifier.IsArray(); return false;
} }
if (member->m_type && StructureComputations(member->m_type).IsAsset()) if (member->m_type && StructureComputations(member->m_type).IsAsset())
@ -933,9 +942,20 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
static bool LoadMember_ShouldMakeReuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) static bool LoadMember_ShouldMakeReuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType)
{ {
return loadType == MemberLoadType::ARRAY_POINTER if(loadType != MemberLoadType::ARRAY_POINTER
|| loadType == MemberLoadType::SINGLE_POINTER && loadType != MemberLoadType::SINGLE_POINTER
|| loadType == MemberLoadType::POINTER_ARRAY; && loadType != MemberLoadType::POINTER_ARRAY)
{
return false;
}
if(loadType == MemberLoadType::POINTER_ARRAY
&& modifier.IsArray())
{
return false;
}
return true;
} }
void LoadMember_Reuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType) void LoadMember_Reuse(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier, const MemberLoadType loadType)
@ -997,16 +1017,16 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
return false; return false;
} }
if (member->m_is_string)
{
return loadType == MemberLoadType::POINTER_ARRAY;
}
if (loadType == MemberLoadType::POINTER_ARRAY) if (loadType == MemberLoadType::POINTER_ARRAY)
{ {
return !modifier.IsArray(); return !modifier.IsArray();
} }
if(member->m_is_string)
{
return false;
}
return true; return true;
} }
@ -1353,11 +1373,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
if (info->m_post_load_action) if (info->m_post_load_action)
{ {
if (startLoadSection) LINE("")
{
startLoadSection = false;
LINE("")
}
LINE(MakeCustomActionCall(info->m_post_load_action.get())) LINE(MakeCustomActionCall(info->m_post_load_action.get()))
} }