/// <summary> /// Rewrites an expression of the type (a + b) /// </summary> /// <param name="binExp"></param> /// <remarks> /// If [[a]] is a complex type, it's with high likelihood a pointer type. If this is the case, /// we want to return something like &(*a).b. If this sum is in a Mem context, the & is removed to yield /// (*a).b. /// <para> /// If [[a]] is a memptr(ptr(A), x), and b is a constant, then we want to return something like &A::b /// </para> /// </remarks> /// <returns>The rewritten expression</returns> public override Expression VisitBinaryExpression(BinaryExpression binExp) { var left = binExp.Left.Accept(this); var right = binExp.Right.Accept(this); DataType dtLeft = DataTypeOf(binExp.Left); DataType dtRight = DataTypeOf(binExp.Right); if (binExp.Operator == Operator.IAdd && dtLeft.IsComplex) { return(TransformComplexSum(binExp, dtLeft, dtRight)); } else { binExp = new BinaryExpression(binExp.Operator, binExp.DataType, left, right) { TypeVariable = binExp.TypeVariable }; store.SetTypeVariableExpression(binExp.TypeVariable, binExp); return(binExp); } }