mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
ZoneCodeGenerator: Add toString methods for operands and operations for debugging purposes
This commit is contained in:
parent
6c1404116c
commit
2bcb776bbf
@ -13,5 +13,10 @@ namespace ZoneCodeGenerator.Domain.Evaluation
|
|||||||
{
|
{
|
||||||
throw new Exception("A dynamic operand cannot be evaluated.");
|
throw new Exception("A dynamic operand cannot be evaluated.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "dynamic";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,5 +20,10 @@ namespace ZoneCodeGenerator.Domain.Evaluation
|
|||||||
{
|
{
|
||||||
Value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Value.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,5 +25,33 @@ namespace ZoneCodeGenerator.Domain.Evaluation
|
|||||||
Operand2 = operand2;
|
Operand2 = operand2;
|
||||||
OperationType = type;
|
OperationType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
string operand1String;
|
||||||
|
string operand2String;
|
||||||
|
|
||||||
|
if (Operand1 is Operation operation1
|
||||||
|
&& operation1.OperationType.Precedence > OperationType.Precedence)
|
||||||
|
{
|
||||||
|
operand1String = $"({Operand1})";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
operand1String = Operand1.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Operand2 is Operation operation2
|
||||||
|
&& operation2.OperationType.Precedence > OperationType.Precedence)
|
||||||
|
{
|
||||||
|
operand2String = $"({Operand2})";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
operand2String = Operand2.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"{operand1String} {OperationType} {operand2String}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user