mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Remove the zonecodegenerator requirement to reference members in a type reference because IW did nasty things in their game that require me to do so.
This commit is contained in:
parent
6437d8daa4
commit
c952aacda1
@ -34,9 +34,11 @@ $endif$
|
||||
|
||||
PrintOperandDynamic(op) ::= <%
|
||||
$TypeVarName(op.Structure.Type)$
|
||||
$if(first(op.ReferencedMemberChain))$
|
||||
->$trunc(op.ReferencedMemberChain):{member | $member.Member.Name$$if(member.Computations.ContainsNonEmbeddedReference)$->$else$.$endif$}$
|
||||
$last(op.ReferencedMemberChain):{member | $member.Member.Name$}$
|
||||
$op.ArrayIndices:{ arrayIndex | [$PrintEvaluation(arrayIndex)$]}$
|
||||
$endif$
|
||||
%>
|
||||
|
||||
PrintOperation(operation) ::= <%
|
||||
|
@ -138,11 +138,6 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
||||
}
|
||||
}
|
||||
|
||||
if (!referencedMemberChain.Any())
|
||||
{
|
||||
throw new TestFailedException($"Typename '{typenameString}' needs to reference a member at this place.");
|
||||
}
|
||||
|
||||
var operandDynamic = new OperandDynamic(referencedType, referencedMemberChain);
|
||||
foreach (var indexEvaluation in arrayIndexEvaluations)
|
||||
{
|
||||
|
@ -397,11 +397,11 @@ namespace ZoneCodeGeneratorTests.Parsing.CommandFile.Tests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EnsureFailsWhenReferencingNoMembersAsDynamicOperands()
|
||||
public void EnsureCanReferenceNoMembersAsDynamicOperands()
|
||||
{
|
||||
tokens.AddRange(new List<string>
|
||||
{
|
||||
"set", "count", "test_struct", ":", ":", "ptrEntry", "1", "+", "test_struct", ";"
|
||||
"set", "count", "test_struct", ":", ":", "ptrEntry", "test_struct", ";"
|
||||
});
|
||||
|
||||
var test = new TestCount();
|
||||
@ -420,7 +420,14 @@ namespace ZoneCodeGeneratorTests.Parsing.CommandFile.Tests
|
||||
|
||||
repository.Add(testStruct);
|
||||
|
||||
Assert.ThrowsException<TestFailedException>(() => test.PerformTest(parserState, lexerMock.Object));
|
||||
Assert.AreEqual(TokenTestResult.Match, test.PerformTest(parserState, lexerMock.Object));
|
||||
Assert.AreEqual(8, test.ConsumedTokenCount);
|
||||
|
||||
Assert.AreNotEqual(ReferenceTypePointer.DefaultCount, pointerReference.Count);
|
||||
Assert.IsFalse(pointerReference.Count.IsStatic);
|
||||
|
||||
Assert.IsInstanceOfType(pointerReference.Count, typeof(OperandDynamic));
|
||||
Assert.AreEqual("test_struct", ((OperandDynamic)pointerReference.Count).Structure.Type.Name);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
Loading…
x
Reference in New Issue
Block a user