public override ICodeNode VisitBinaryExpression (BinaryExpression node)
		{
			var result = Pattern.CodePattern.Match (CanCastPattern, node);
			if (!result.Success)
				return base.VisitBinaryExpression (node);

			var safe_cast = (SafeCastExpression) result [SafeCastKey];
			return new CanCastExpression (
				(Expression) Visit (safe_cast.Expression),
				safe_cast.TargetType);
		}
		public override ICodeNode VisitBinaryExpression (BinaryExpression node)
		{
			if (node.Operator != BinaryOperator.GreaterThan)
				return base.VisitBinaryExpression (node);

			var literal = node.Right as LiteralExpression;
			if (literal == null)
				return base.VisitBinaryExpression (node);

			if (literal.Value != null)
				return base.VisitBinaryExpression (node);

			var safe_cast = node.Left as SafeCastExpression;
			if (safe_cast == null)
				return base.VisitBinaryExpression (node);

			return new CanCastExpression (safe_cast.Expression, safe_cast.TargetType);
		}
		public override void VisitBinaryExpression (BinaryExpression node)
		{
			var was_inside = inside_binary;
			inside_binary = true;

			if (was_inside)
				WriteToken ("(");
			Visit (node.Left);
			WriteSpace ();
			Write (ToString (node.Operator));
			WriteSpace ();
			Visit (node.Right);
			if (was_inside)
				WriteToken (")");

			inside_binary = was_inside;
		}
Beispiel #4
0
 public override ICodeNode VisitBinaryExpression(BinaryExpression node)
 {
     node = (BinaryExpression)base.VisitBinaryExpression(node);
     return new TypedBinaryExpression(node.Operator, node.Left, node.Right);
 }
Beispiel #5
0
		public virtual void VisitBinaryExpression (BinaryExpression node)
		{
			Visit (node.Left);
			Visit (node.Right);
		}