public static NeuOperation Divide( this NeuInterpreter interpreter, NeuOperation lhs, NeuOperation rhs) { switch (true) { case var _ when lhs is NeuFloat lhsFloat && rhs is NeuFloat rhsFloat: return(interpreter.Divide(lhsFloat, rhsFloat)); /// case var _ when lhs is NeuInteger lhsInt && rhs is NeuInteger rhsInt: return(interpreter.Divide(lhsInt, rhsInt)); /// default: throw new Exception(); } }
public static NeuOperation Execute( this NeuInterpreter interpreter, NeuBinaryOperator op, NeuOperation lhsResult, NeuOperation rhsResult) { switch (op.OperatorType) { case NeuBinaryOperatorType.Multiply: return(interpreter.Multiply(lhsResult, rhsResult)); /// case NeuBinaryOperatorType.Divide: return(interpreter.Divide(lhsResult, rhsResult)); /// case NeuBinaryOperatorType.Add: return(interpreter.Add(lhsResult, rhsResult)); /// case NeuBinaryOperatorType.Subtract: return(interpreter.Subtract(lhsResult, rhsResult)); /// default: throw new Exception(); } }