2
0
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:
Jan
2019-11-10 18:04:00 +01:00
parent 2bcb776bbf
commit f2cc95ee32
15 changed files with 275 additions and 41 deletions

View File

@@ -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}]"))}";
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -4,7 +4,7 @@ using System.Linq;
using ZoneCodeGenerator.Domain.FastFileStructure;
using ZoneCodeGenerator.Persistence;
namespace ZoneCodeGenerator.Domain.StructureInformation
namespace ZoneCodeGenerator.Domain.Information
{
class StructureInformation
{