public override void Visit(BinOpExpression expression) { expression.Left.AcceptVisitor(this); var type1 = ResultType; expression.Right.AcceptVisitor(this); var type2 = ResultType; if (expression.Operation == BinOps.Add || expression.Operation == BinOps.Div || expression.Operation == BinOps.Mul || expression.Operation == BinOps.Sub) { if (type1 == typeof (int)) { if(type2 == typeof(long)) throw new InvalidProgramException("Operation types are invalid"); ResultType = typeof (int); } else if (type1 == typeof (long)) { if (type2 == typeof (int)) throw new InvalidProgramException("Operation types are invalid"); ResultType = typeof (long); } } }
public override void Visit(BinOpExpression expression) { throw new NotImplementedException(); }
public abstract void Visit(BinOpExpression expression);