public static NeuOperation Add( this NeuInterpreter interpreter, NeuOperation lhs, NeuOperation rhs) { switch (true) { case var _ when lhs is NeuFloat lhsFloat && rhs is NeuFloat rhsFloat: return(interpreter.Add(lhsFloat, rhsFloat)); /// case var _ when lhs is NeuInteger lhsInt && rhs is NeuInteger rhsInt: return(interpreter.Add(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(); } }