ZoneCodeGenerator: Add computations to check for dynamic array sizes and partially loaded structures

This commit is contained in:
Jan 2019-12-22 16:16:21 +01:00
parent ec8c00a4b9
commit 0db6f90980
2 changed files with 12 additions and 0 deletions

View File

@ -84,6 +84,15 @@ namespace ZoneCodeGenerator.Generating.Computations
information.Parent.OrderedMembers.LastOrDefault(member => information.Parent.OrderedMembers.LastOrDefault(member =>
!member.IsLeaf && !member.Computations.ShouldIgnore) == information; !member.IsLeaf && !member.Computations.ShouldIgnore) == information;
public bool HasDynamicArraySize => information.Member.VariableType.References
.OfType<ReferenceTypeArray>()
.Any(array => array.DynamicSize != null);
public bool IsBarrier => HasDynamicArraySize ||
information.StructureType != null &&
information.StructureType != information.Parent &&
information.StructureType.Computations.Barrier != null;
public MemberReferenceComputations References => new MemberReferenceComputations(information); public MemberReferenceComputations References => new MemberReferenceComputations(information);
public MemberComputations(MemberInformation information) public MemberComputations(MemberInformation information)

View File

@ -12,6 +12,9 @@ namespace ZoneCodeGenerator.Generating.Computations
public bool IsUsed => information.Usages.Any(); public bool IsUsed => information.Usages.Any();
public MemberInformation Barrier =>
information.OrderedMembers.FirstOrDefault(memberInformation => memberInformation.Computations.IsBarrier);
public StructureComputations(StructureInformation information) public StructureComputations(StructureInformation information)
{ {
this.information = information; this.information = information;