public static string ToInstructionString(this NumericInstructionOperator @operator) { return(@operator switch { NumericInstructionOperator.Add => "ADD", NumericInstructionOperator.Subtract => "SUB", NumericInstructionOperator.Multiply => "MUL", NumericInstructionOperator.Divide => "DIV", _ => throw ExhaustiveMatch.Failed(@operator) });
public NumericInstruction( Place resultPlace, NumericInstructionOperator @operator, NumericType type, Operand leftOperand, Operand rightOperand, Scope scope) : base(resultPlace, TextSpan.Covering(leftOperand.Span, rightOperand.Span), scope) { LeftOperand = leftOperand; RightOperand = rightOperand; Operator = @operator; Type = type; }