Skip to content

Commit b20d5d8

Browse files
committed
libifps: allow Instruction.Create(OpCode, Operand, Operand, Operand) to be used for InlineCmpValueType too
libasm: allow generic operand to be used for InlineCmpValueType op2, as well as type tests: refactor and fix tests: add test for InlineCmpValueType on type and variable
1 parent 8aea82c commit b20d5d8

File tree

9 files changed

+365
-3105
lines changed

9 files changed

+365
-3105
lines changed

IFPSAsmLib/Assembler.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,20 @@ Dictionary<string, ParserElement> defines
693693
var op1 = ParseOperandValue(next, function, types, globals, functions, aliases, defines);
694694
if (next.Next == null) next.ThrowInvalid();
695695
next = next.Next;
696-
next.ExpectValidName();
697-
next.EnsureNoNextChild();
698-
if (!types.TryGetValue(next.Value, out var typeOp)) next.ThrowInvalid(string.Format("In function \"{0}\": Referenced unknown type", function.Name));
696+
Operand op2 = null;
697+
try
698+
{
699+
op2 = ParseOperandValue(next, function, types, globals, functions, aliases, defines);
700+
}
701+
catch
702+
{
703+
next.ExpectValidName();
704+
next.EnsureNoNextChild();
705+
if (!types.TryGetValue(next.Value, out var typeOp)) next.ThrowInvalid(string.Format("In function \"{0}\": Referenced unknown type", function.Name));
706+
op2 = Operand.Create(typeOp);
707+
}
699708
if (next.Next != null) next.Next.ThrowInvalid();
700-
return Instruction.Create(opcode, op0, op1, typeOp);
709+
return Instruction.Create(opcode, op0, op1, op2);
701710
}
702711
case OperandType.InlineTypeVariable:
703712
{

0 commit comments

Comments
 (0)