mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-06 16:57:25 +00:00
ZoneCodeGenerator: Make use of the parsed tokens in TestCount and TestCondition
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZoneCodeGenerator.Domain.Information;
|
||||
|
||||
namespace ZoneCodeGenerator.Domain.Evaluation
|
||||
{
|
||||
class OperandDynamic : IEvaluation
|
||||
{
|
||||
public StructureInformation Structure { get; }
|
||||
public IList<MemberInformation> ReferencedMemberChain { get; }
|
||||
public IList<int> ArrayIndices { get; }
|
||||
|
||||
public bool IsStatic => false;
|
||||
|
||||
public OperandDynamic(StructureInformation structure, IEnumerable<MemberInformation> memberChain)
|
||||
{
|
||||
Structure = structure;
|
||||
ReferencedMemberChain = new List<MemberInformation>(memberChain);
|
||||
ArrayIndices = new List<int>();
|
||||
}
|
||||
|
||||
public int EvaluateNumeric()
|
||||
{
|
||||
throw new Exception("A dynamic operand cannot be evaluated.");
|
||||
@@ -16,7 +27,7 @@ namespace ZoneCodeGenerator.Domain.Evaluation
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "dynamic";
|
||||
return $"{Structure.Type.FullName}::{string.Join("::", ReferencedMemberChain.Select(information => information.Member.Name))}{string.Concat(ArrayIndices.Select(i => $"[{i}]"))}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,16 +1,20 @@
|
||||
namespace ZoneCodeGenerator.Domain.StructureInformation
|
||||
using ZoneCodeGenerator.Domain.Evaluation;
|
||||
|
||||
namespace ZoneCodeGenerator.Domain.Information
|
||||
{
|
||||
class MemberInformation
|
||||
{
|
||||
public StructureInformation StructureType { get; }
|
||||
public Variable Member { get; set; }
|
||||
public bool IsScriptString { get; set; }
|
||||
public IEvaluation Condition { get; set; }
|
||||
|
||||
public MemberInformation(Variable member, StructureInformation structureType)
|
||||
{
|
||||
Member = member;
|
||||
StructureType = structureType;
|
||||
IsScriptString = false;
|
||||
Condition = null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using ZoneCodeGenerator.Domain.FastFileStructure;
|
||||
using ZoneCodeGenerator.Persistence;
|
||||
|
||||
namespace ZoneCodeGenerator.Domain.StructureInformation
|
||||
namespace ZoneCodeGenerator.Domain.Information
|
||||
{
|
||||
class StructureInformation
|
||||
{
|
Reference in New Issue
Block a user