public object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) { B.Expression left = ConvertExpression(binaryOperatorExpression.Left); B.Expression right = ConvertExpression(binaryOperatorExpression.Right); B.BinaryOperatorType op = ConvertOperator(binaryOperatorExpression.Op); if (op == B.BinaryOperatorType.None) { AddError(binaryOperatorExpression, "Unknown operator."); return(null); } // if (binaryOperatorExpression.Op == BinaryOperatorType.DivideInteger) { // AddWarning(binaryOperatorExpression, "Integer division converted to normal division."); // } return(new B.BinaryExpression(GetLexicalInfo(binaryOperatorExpression), op, left, right)); }
public object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) { B.Expression left = ConvertExpression(assignmentExpression.Left); B.Expression right = ConvertExpression(assignmentExpression.Right); bool isInPlace; B.BinaryOperatorType op = ConvertOperator(assignmentExpression.Op, out isInPlace); if (op == B.BinaryOperatorType.None) { AddError(assignmentExpression, "Unknown operator."); return(null); } if (!isInPlace) { // convert L <OP>= R to L = L OP R right = new B.BinaryExpression(GetLexicalInfo(assignmentExpression), op, left, right); op = B.BinaryOperatorType.Assign; } return(new B.BinaryExpression(GetLexicalInfo(assignmentExpression), op, left, right)); }