mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-25 22:01:54 +00:00
ZoneCodeGenerator: Add helper methods to Operation for the template engine to know whether parenthesis are required or not
This commit is contained in:
@ -9,7 +9,13 @@ namespace ZoneCodeGenerator.Domain.Evaluation
|
|||||||
class Operation : IEvaluation
|
class Operation : IEvaluation
|
||||||
{
|
{
|
||||||
public IEvaluation Operand1 { get; }
|
public IEvaluation Operand1 { get; }
|
||||||
|
public bool Operand1NeedsParenthesis => Operand1 is Operation operation1 &&
|
||||||
|
operation1.OperationType.Precedence > OperationType.Precedence;
|
||||||
|
|
||||||
public IEvaluation Operand2 { get; }
|
public IEvaluation Operand2 { get; }
|
||||||
|
public bool Operand2NeedsParenthesis => Operand2 is Operation operation2 &&
|
||||||
|
operation2.OperationType.Precedence > OperationType.Precedence;
|
||||||
|
|
||||||
public OperationType OperationType { get; }
|
public OperationType OperationType { get; }
|
||||||
|
|
||||||
public bool IsStatic => Operand1.IsStatic && Operand2.IsStatic;
|
public bool IsStatic => Operand1.IsStatic && Operand2.IsStatic;
|
||||||
|
Reference in New Issue
Block a user