Пример #1
0
		public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
			Debug.Assert((binaryOperatorExpression != null));
			Debug.Assert((binaryOperatorExpression.Left != null));
			Debug.Assert((binaryOperatorExpression.Right != null));
			binaryOperatorExpression.Left.AcceptVisitor(this, data);
			return binaryOperatorExpression.Right.AcceptVisitor(this, data);
		}
Пример #2
0
		/// <summary>
		/// Returns the existing expression plus the specified integer value.
		/// The old <paramref name="expr"/> object is not modified, but might be a subobject on the new expression
		/// (and thus its parent property is modified).
		/// </summary>
		public static Expression AddInteger(Expression expr, int value)
		{
			PrimitiveExpression pe = expr as PrimitiveExpression;
			if (pe != null && pe.Value is int) {
				int newVal = (int)pe.Value + value;
				return new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
			}
			BinaryOperatorExpression boe = expr as BinaryOperatorExpression;
			if (boe != null && boe.Op == BinaryOperatorType.Add) {
				// clone boe:
				boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);
				
				boe.Right = AddInteger(boe.Right, value);
				if (boe.Right is PrimitiveExpression && ((PrimitiveExpression)boe.Right).Value is int) {
					int newVal = (int)((PrimitiveExpression)boe.Right).Value;
					if (newVal == 0) {
						return boe.Left;
					} else if (newVal < 0) {
						((PrimitiveExpression)boe.Right).Value = -newVal;
						boe.Op = BinaryOperatorType.Subtract;
					}
				}
				return boe;
			}
			if (boe != null && boe.Op == BinaryOperatorType.Subtract) {
				pe = boe.Right as PrimitiveExpression;
				if (pe != null && pe.Value is int) {
					int newVal = (int)pe.Value - value;
					if (newVal == 0)
						return boe.Left;
					
					// clone boe:
					boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);
					
					if (newVal < 0) {
						newVal = -newVal;
						boe.Op = BinaryOperatorType.Add;
					}
					boe.Right = new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
					return boe;
				}
			}
			BinaryOperatorType opType = BinaryOperatorType.Add;
			if (value < 0) {
				value = -value;
				opType = BinaryOperatorType.Subtract;
			}
			return new BinaryOperatorExpression(expr, opType, new PrimitiveExpression(value, value.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)));
		}
Пример #3
0
	void MultiplicativeExpr(out Expression outExpr) {
		Expression expr;
		BinaryOperatorType op = BinaryOperatorType.None;
		Location startLocation = la.Location;

		UnaryExpr(out outExpr);
		while (la.kind == 24 || la.kind == 34) {
			if (la.kind == 34) {
				Get();
				op = BinaryOperatorType.Multiply;
			} else {
				Get();
				op = BinaryOperatorType.Divide;
			}
			UnaryExpr(out expr);
			outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation };
		}
	}
Пример #4
0
	void IntegerDivisionExpr(out Expression outExpr) {
		Expression expr; Location startLocation = la.Location;
		MultiplicativeExpr(out outExpr);
		while (la.kind == 25) {
			Get();
			MultiplicativeExpr(out expr);
			outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.DivideInteger, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
		}
	}
Пример #5
0
	void ModuloExpr(out Expression outExpr) {
		Expression expr; Location startLocation = la.Location;
		IntegerDivisionExpr(out outExpr);
		while (la.kind == 154) {
			Get();
			IntegerDivisionExpr(out expr);
			outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Modulus, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
		}
	}
Пример #6
0
	void AdditiveExpr(out Expression outExpr) {
		Expression expr;
		BinaryOperatorType op = BinaryOperatorType.None;
		Location startLocation = la.Location;

		ModuloExpr(out outExpr);
		while (la.kind == 30 || la.kind == 31) {
			if (la.kind == 31) {
				Get();
				op = BinaryOperatorType.Add;
			} else {
				Get();
				op = BinaryOperatorType.Subtract;
			}
			ModuloExpr(out expr);
			outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
		}
	}
Пример #7
0
		public sealed override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
			this.BeginVisit(binaryOperatorExpression);
			object result = this.TrackedVisitBinaryOperatorExpression(binaryOperatorExpression, data);
			this.EndVisit(binaryOperatorExpression);
			return result;
		}
Пример #8
0
		public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
			Debug.Assert((binaryOperatorExpression != null));
			Debug.Assert((binaryOperatorExpression.Left != null));
			Debug.Assert((binaryOperatorExpression.Right != null));
			nodeStack.Push(binaryOperatorExpression.Left);
			binaryOperatorExpression.Left.AcceptVisitor(this, data);
			binaryOperatorExpression.Left = ((Expression)(nodeStack.Pop()));
			nodeStack.Push(binaryOperatorExpression.Right);
			binaryOperatorExpression.Right.AcceptVisitor(this, data);
			binaryOperatorExpression.Right = ((Expression)(nodeStack.Pop()));
			return null;
		}
Пример #9
0
	void ConjunctionExpr(out Expression outExpr) {
		Expression expr;
		BinaryOperatorType op = BinaryOperatorType.None;
		Location startLocation = la.Location;

		NotExpr(out outExpr);
		while (la.kind == 60 || la.kind == 61) {
			if (la.kind == 60) {
				Get();
				op = BinaryOperatorType.BitwiseAnd;
			} else {
				Get();
				op = BinaryOperatorType.LogicalAnd;
			}
			NotExpr(out expr);
			outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
		}
	}
Пример #10
0
	void ConditionalExpression(out Expression expr) {
		ConditionalExpression conditionalExpression = new ConditionalExpression();
		BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression();
		conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location;

		Expression condition = null;
		Expression trueExpr = null;
		Expression falseExpr = null;

		Expect(135);
		Expect(37);
		Expr(out condition);
		Expect(22);
		Expr(out trueExpr);
		if (la.kind == 22) {
			Get();
			Expr(out falseExpr);
		}
		Expect(38);
		if(falseExpr != null)
			{
				conditionalExpression.Condition = condition;
				conditionalExpression.TrueExpression = trueExpr;
				conditionalExpression.FalseExpression = falseExpr;
				conditionalExpression.EndLocation = t.EndLocation;
				
				expr = conditionalExpression;
			}
			else
			{
				binaryOperatorExpression.Left = condition;
				binaryOperatorExpression.Right = trueExpr;
				binaryOperatorExpression.Op = BinaryOperatorType.NullCoalescing;
				binaryOperatorExpression.EndLocation = t.EndLocation;
				
				expr = binaryOperatorExpression;
			}

	}
Пример #11
0
	void SimpleNonInvocationExpression(out Expression pexpr) {
		Expression expr;
		CollectionInitializerExpression cie;
		TypeReference type = null;
		string name = String.Empty;
		Location startLocation = la.Location;
		pexpr = null;

		if (StartOf(34)) {
			switch (la.kind) {
			case 3: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 4: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 7: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 6: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 5: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 9: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 8: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 217: {
				Get();
				pexpr = new PrimitiveExpression(true, "true"); 
				break;
			}
			case 122: {
				Get();
				pexpr = new PrimitiveExpression(false, "false");
				break;
			}
			case 165: {
				Get();
				pexpr = new PrimitiveExpression(null, "null"); 
				break;
			}
			case 37: {
				Get();
				Expr(out expr);
				Expect(38);
				pexpr = new ParenthesizedExpression(expr);
				break;
			}
			case 2: case 58: case 62: case 64: case 65: case 66: case 67: case 70: case 87: case 98: case 104: case 107: case 116: case 121: case 126: case 133: case 139: case 143: case 146: case 147: case 170: case 176: case 178: case 184: case 203: case 212: case 213: case 223: case 224: case 230: {
				Identifier();
				pexpr = new IdentifierExpression(t.val);
					pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;

				if (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
					Expect(37);
					Expect(169);
					TypeArgumentList(((IdentifierExpression)pexpr).TypeArguments);
					Expect(38);
				}
				break;
			}
			case 68: case 71: case 82: case 99: case 100: case 109: case 141: case 151: case 168: case 196: case 201: case 202: case 208: case 221: case 222: case 225: {
				string val = String.Empty;
				if (StartOf(13)) {
					PrimitiveTypeName(out val);
				} else {
					Get();
					val = "System.Object";
				}
				pexpr = new TypeReferenceExpression(new TypeReference(val, true));
				break;
			}
			case 153: {
				Get();
				pexpr = new ThisReferenceExpression();
				break;
			}
			case 158: case 159: {
				Expression retExpr = null;
				if (la.kind == 158) {
					Get();
					retExpr = new BaseReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation };
				} else {
					Get();
					retExpr = new ClassReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation };
				}
				Expect(26);
				IdentifierOrKeyword(out name);
				pexpr = new MemberReferenceExpression(retExpr, name) { StartLocation = startLocation, EndLocation = t.EndLocation };
				break;
			}
			case 130: {
				Get();
				Expect(26);
				Identifier();
				type = new TypeReference(t.val ?? "");
				type.IsGlobal = true;
				pexpr = new TypeReferenceExpression(type);
				break;
			}
			case 162: {
				ObjectCreateExpression(out expr);
				pexpr = expr;
				break;
			}
			case 35: {
				CollectionInitializer(out cie);
				pexpr = cie;
				break;
			}
			case 94: case 106: case 219: {
				CastType castType = CastType.Cast;
				if (la.kind == 106) {
					Get();
				} else if (la.kind == 94) {
					Get();
					castType = CastType.Conversion;
				} else {
					Get();
					castType = CastType.TryCast;
				}
				Expect(37);
				Expr(out expr);
				Expect(22);
				TypeName(out type);
				Expect(38);
				pexpr = new CastExpression(type, expr, castType);
				break;
			}
			case 76: case 77: case 78: case 79: case 80: case 81: case 83: case 85: case 86: case 90: case 91: case 92: case 93: case 95: case 96: case 97: {
				CastTarget(out type);
				Expect(37);
				Expr(out expr);
				Expect(38);
				pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion);
				break;
			}
			case 57: {
				Get();
				SimpleExpr(out expr);
				pexpr = new AddressOfExpression(expr);
				break;
			}
			case 129: {
				Get();
				Expect(37);
				GetTypeTypeName(out type);
				Expect(38);
				pexpr = new TypeOfExpression(type);
				break;
			}
			case 220: {
				Get();
				SimpleExpr(out expr);
				Expect(144);
				TypeName(out type);
				pexpr = new TypeOfIsExpression(expr, type);
				break;
			}
			case 135: {
				ConditionalExpression(out pexpr);
				break;
			}
			case 10: case 16: case 17: case 18: case 19: {
				XmlLiteralExpression(out pexpr);
				break;
			}
			}
		} else if (StartOf(35)) {
			if (la.kind == 26) {
				Get();
				if (la.kind == 10) {
					Get();
					IdentifierOrKeyword(out name);
					Expect(11);
					pexpr = new XmlMemberAccessExpression(null, XmlAxisType.Element, name, true) { StartLocation = startLocation, EndLocation = t.EndLocation };
				} else if (StartOf(33)) {
					IdentifierOrKeyword(out name);
					pexpr = new MemberReferenceExpression(null, name) { StartLocation = startLocation, EndLocation = t.EndLocation };
				} else SynErr(281);
			} else if (la.kind == 29) {
				Get();
				IdentifierOrKeyword(out name);
				pexpr = new BinaryOperatorExpression(null, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name) { StartLocation = t.Location, EndLocation = t.EndLocation });
			} else {
				XmlAxisType axisType = XmlAxisType.Element; bool isXmlIdentifier = false;
				if (la.kind == 27) {
					Get();
					axisType = XmlAxisType.Descendents;
				} else {
					Get();
					axisType = XmlAxisType.Attribute;
				}
				if (la.kind == 10) {
					Get();
					isXmlIdentifier = true;
				}
				IdentifierOrKeyword(out name);
				if (la.kind == 11) {
					Get();
				}
				pexpr = new XmlMemberAccessExpression(null, axisType, name, isXmlIdentifier);
			}
		} else SynErr(282);
		if (pexpr != null) {
				pexpr.StartLocation = startLocation;
				pexpr.EndLocation = t.EndLocation;
			}

	}
Пример #12
0
	void SimpleExpr(out Expression pexpr) {
		string name; Location startLocation = la.Location;
		SimpleNonInvocationExpression(out pexpr);
		while (StartOf(32)) {
			if (la.kind == 26) {
				Get();
				if (la.kind == 10) {
					Get();
					IdentifierOrKeyword(out name);
					Expect(11);
					pexpr = new XmlMemberAccessExpression(pexpr, XmlAxisType.Element, name, true);
				} else if (StartOf(33)) {
					IdentifierOrKeyword(out name);
					pexpr = new MemberReferenceExpression(pexpr, name) { StartLocation = startLocation, EndLocation = t.EndLocation };
				} else SynErr(280);
				if (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
					Expect(37);
					Expect(169);
					TypeArgumentList(((MemberReferenceExpression)pexpr).TypeArguments);
					Expect(38);
				}
			} else if (la.kind == 29) {
				Get();
				IdentifierOrKeyword(out name);
				pexpr = new BinaryOperatorExpression(pexpr, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name) { StartLocation = t.Location, EndLocation = t.EndLocation });
			} else if (la.kind == 27 || la.kind == 28) {
				XmlAxisType type = XmlAxisType.Attribute; bool isXmlName = false;
				if (la.kind == 28) {
					Get();
				} else {
					Get();
					type = XmlAxisType.Descendents;
				}
				if (la.kind == 10) {
					Get();
					isXmlName = true;
				}
				IdentifierOrKeyword(out name);
				if (la.kind == 11) {
					Get();
				}
				pexpr = new XmlMemberAccessExpression(pexpr, type, name, isXmlName);
			} else {
				InvocationExpression(ref pexpr);
			}
		}
		if (pexpr != null) {
				pexpr.StartLocation = startLocation;
				pexpr.EndLocation = t.EndLocation;
			}

	}
Пример #13
0
	void DisjunctionExpr(out Expression outExpr) {
		Expression expr;
		BinaryOperatorType op = BinaryOperatorType.None;
		Location startLocation = la.Location;

		ConjunctionExpr(out outExpr);
		while (la.kind == 175 || la.kind == 177 || la.kind == 236) {
			if (la.kind == 175) {
				Get();
				op = BinaryOperatorType.BitwiseOr;
			} else if (la.kind == 177) {
				Get();
				op = BinaryOperatorType.LogicalOr;
			} else {
				Get();
				op = BinaryOperatorType.ExclusiveOr;
			}
			ConjunctionExpr(out expr);
			outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
		}
	}
Пример #14
0
		public virtual object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
			return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
		}
Пример #15
0
	void ExponentiationExpr(out Expression outExpr) {
		Expression expr; Location startLocation = la.Location;
		SimpleExpr(out outExpr);
		while (la.kind == 32) {
			Get();
			SimpleExpr(out expr);
			outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Power, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
		}
	}
Пример #16
0
        /// <summary>
        /// Returns the existing expression plus the specified integer value.
        /// The old <paramref name="expr"/> object is not modified, but might be a subobject on the new expression
        /// (and thus its parent property is modified).
        /// </summary>
        public static Expression AddInteger(Expression expr, int value)
        {
            PrimitiveExpression pe = expr as PrimitiveExpression;

            if (pe != null && pe.Value is int)
            {
                int newVal = (int)pe.Value + value;
                return(new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)));
            }
            BinaryOperatorExpression boe = expr as BinaryOperatorExpression;

            if (boe != null && boe.Op == BinaryOperatorType.Add)
            {
                // clone boe:
                boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);

                boe.Right = AddInteger(boe.Right, value);
                if (boe.Right is PrimitiveExpression && ((PrimitiveExpression)boe.Right).Value is int)
                {
                    int newVal = (int)((PrimitiveExpression)boe.Right).Value;
                    if (newVal == 0)
                    {
                        return(boe.Left);
                    }
                    else if (newVal < 0)
                    {
                        ((PrimitiveExpression)boe.Right).Value = -newVal;
                        boe.Op = BinaryOperatorType.Subtract;
                    }
                }
                return(boe);
            }
            if (boe != null && boe.Op == BinaryOperatorType.Subtract)
            {
                pe = boe.Right as PrimitiveExpression;
                if (pe != null && pe.Value is int)
                {
                    int newVal = (int)pe.Value - value;
                    if (newVal == 0)
                    {
                        return(boe.Left);
                    }

                    // clone boe:
                    boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);

                    if (newVal < 0)
                    {
                        newVal = -newVal;
                        boe.Op = BinaryOperatorType.Add;
                    }
                    boe.Right = new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
                    return(boe);
                }
            }
            BinaryOperatorType opType = BinaryOperatorType.Add;

            if (value < 0)
            {
                value  = -value;
                opType = BinaryOperatorType.Subtract;
            }
            return(new BinaryOperatorExpression(expr, opType, new PrimitiveExpression(value, value.ToString(System.Globalization.NumberFormatInfo.InvariantInfo))));
        }
Пример #17
0
	void ComparisonExpr(out Expression outExpr) {
		Expression expr;
		BinaryOperatorType op = BinaryOperatorType.None;
		Location startLocation = la.Location;

		ShiftExpr(out outExpr);
		while (StartOf(40)) {
			switch (la.kind) {
			case 40: {
				Get();
				op = BinaryOperatorType.LessThan;
				break;
			}
			case 39: {
				Get();
				op = BinaryOperatorType.GreaterThan;
				break;
			}
			case 43: {
				Get();
				op = BinaryOperatorType.LessThanOrEqual;
				break;
			}
			case 42: {
				Get();
				op = BinaryOperatorType.GreaterThanOrEqual;
				break;
			}
			case 41: {
				Get();
				op = BinaryOperatorType.InEquality;
				break;
			}
			case 20: {
				Get();
				op = BinaryOperatorType.Equality;
				break;
			}
			case 150: {
				Get();
				op = BinaryOperatorType.Like;
				break;
			}
			case 144: {
				Get();
				op = BinaryOperatorType.ReferenceEquality;
				break;
			}
			case 145: {
				Get();
				op = BinaryOperatorType.ReferenceInequality;
				break;
			}
			}
			if (StartOf(41)) {
				ShiftExpr(out expr);
				outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
			} else if (la.kind == 164) {
				Location startLocation2 = la.Location;
				Get();
				ShiftExpr(out expr);
				outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not) { StartLocation = startLocation2, EndLocation = t.EndLocation }) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
			} else SynErr(292);
		}
	}
		public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
			throw new global::System.NotImplementedException("BinaryOperatorExpression");
		}
Пример #19
0
	void ShiftExpr(out Expression outExpr) {
		Expression expr;
		BinaryOperatorType op = BinaryOperatorType.None;
		Location startLocation = la.Location;

		ConcatenationExpr(out outExpr);
		while (la.kind == 44 || la.kind == 45) {
			if (la.kind == 44) {
				Get();
				op = BinaryOperatorType.ShiftLeft;
			} else {
				Get();
				op = BinaryOperatorType.ShiftRight;
			}
			ConcatenationExpr(out expr);
			outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
		}
	}
Пример #20
0
	void ConcatenationExpr(out Expression outExpr) {
		Expression expr; Location startLocation = la.Location;
		AdditiveExpr(out outExpr);
		while (la.kind == 23) {
			Get();
			AdditiveExpr(out expr);
			outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Concat, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
		}
	}
Пример #21
0
		public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
		{
			CodeBinaryOperatorType op = CodeBinaryOperatorType.Add;
			switch (binaryOperatorExpression.Op) {
				case BinaryOperatorType.Add:
					op = CodeBinaryOperatorType.Add;
					break;
				case BinaryOperatorType.BitwiseAnd:
					op = CodeBinaryOperatorType.BitwiseAnd;
					break;
				case BinaryOperatorType.BitwiseOr:
					op = CodeBinaryOperatorType.BitwiseOr;
					break;
				case BinaryOperatorType.LogicalAnd:
					op = CodeBinaryOperatorType.BooleanAnd;
					break;
				case BinaryOperatorType.LogicalOr:
					op = CodeBinaryOperatorType.BooleanOr;
					break;
				case BinaryOperatorType.Divide:
				case BinaryOperatorType.DivideInteger:
					op = CodeBinaryOperatorType.Divide;
					break;
				case BinaryOperatorType.GreaterThan:
					op = CodeBinaryOperatorType.GreaterThan;
					break;
				case BinaryOperatorType.GreaterThanOrEqual:
					op = CodeBinaryOperatorType.GreaterThanOrEqual;
					break;
				case BinaryOperatorType.Equality:
				case BinaryOperatorType.InEquality:
					op = CodeBinaryOperatorType.ValueEquality;
					break;
				case BinaryOperatorType.LessThan:
					op = CodeBinaryOperatorType.LessThan;
					break;
				case BinaryOperatorType.LessThanOrEqual:
					op = CodeBinaryOperatorType.LessThanOrEqual;
					break;
				case BinaryOperatorType.Modulus:
					op = CodeBinaryOperatorType.Modulus;
					break;
				case BinaryOperatorType.Multiply:
					op = CodeBinaryOperatorType.Multiply;
					break;
				case BinaryOperatorType.Subtract:
					op = CodeBinaryOperatorType.Subtract;
					break;
				case BinaryOperatorType.ShiftLeft:
				case BinaryOperatorType.ShiftRight:
					// CodeDOM suxx
					op = CodeBinaryOperatorType.Multiply;
					break;
				case BinaryOperatorType.ReferenceEquality:
					op = CodeBinaryOperatorType.IdentityEquality;
					break;
				case BinaryOperatorType.ReferenceInequality:
					op = CodeBinaryOperatorType.IdentityInequality;
					break;
					
				case BinaryOperatorType.ExclusiveOr:
					// CodeDom doesn't support ExclusiveOr
					op = CodeBinaryOperatorType.BitwiseAnd;
					break;
			}

			System.Diagnostics.Debug.Assert(!binaryOperatorExpression.Left.IsNull);
			System.Diagnostics.Debug.Assert(!binaryOperatorExpression.Right.IsNull);

			var cboe = new CodeBinaryOperatorExpression(
				(CodeExpression)binaryOperatorExpression.Left.AcceptVisitor(this, data),
				op,
				(CodeExpression)binaryOperatorExpression.Right.AcceptVisitor(this, data));
			if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
				cboe = new CodeBinaryOperatorExpression(cboe, CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression(false));
			}
			return cboe;
		}