diff --git a/src/ZoneCodeGenerator/Domain/Evaluation/Operation.cs b/src/ZoneCodeGenerator/Domain/Evaluation/Operation.cs index 3ae2afab..312dfafb 100644 --- a/src/ZoneCodeGenerator/Domain/Evaluation/Operation.cs +++ b/src/ZoneCodeGenerator/Domain/Evaluation/Operation.cs @@ -9,7 +9,13 @@ namespace ZoneCodeGenerator.Domain.Evaluation class Operation : IEvaluation { public IEvaluation Operand1 { get; } + public bool Operand1NeedsParenthesis => Operand1 is Operation operation1 && + operation1.OperationType.Precedence > OperationType.Precedence; + public IEvaluation Operand2 { get; } + public bool Operand2NeedsParenthesis => Operand2 is Operation operation2 && + operation2.OperationType.Precedence > OperationType.Precedence; + public OperationType OperationType { get; } public bool IsStatic => Operand1.IsStatic && Operand2.IsStatic;