mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-06 16:57:25 +00:00
ZoneCodeGenerator: Make pointer counts be able to differ by array index
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ZoneCodeGenerator.Domain.Evaluation;
|
||||
|
||||
namespace ZoneCodeGenerator.Domain
|
||||
@@ -8,7 +10,20 @@ namespace ZoneCodeGenerator.Domain
|
||||
public static IEvaluation DefaultCount = new OperandStatic(1);
|
||||
|
||||
public IEvaluation Count { get; set; } = DefaultCount;
|
||||
public IEvaluation[] CountByArrayIndex { get; set; }
|
||||
public bool HasCountByArrayIndex => CountByArrayIndex != null;
|
||||
|
||||
public bool IsArray => !Count.IsStatic || Count.EvaluateNumeric() > 1;
|
||||
private static bool EvaluationIsArray(IEvaluation eval)
|
||||
{
|
||||
return !eval.IsStatic || eval.EvaluateNumeric() > 1;
|
||||
}
|
||||
|
||||
public bool IsArray(int index)
|
||||
{
|
||||
return EvaluationIsArray(HasCountByArrayIndex ? CountByArrayIndex[index] : Count);
|
||||
}
|
||||
|
||||
public bool AnyIsArray =>
|
||||
HasCountByArrayIndex ? CountByArrayIndex.Any(EvaluationIsArray) : EvaluationIsArray(Count);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user