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);
		}
Ejemplo n.º 2
0
		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;
		}
Ejemplo n.º 4
0
 public override ICodeNode VisitBinaryExpression(BinaryExpression node)
 {
     node = (BinaryExpression)base.VisitBinaryExpression(node);
     return new TypedBinaryExpression(node.Operator, node.Left, node.Right);
 }
Ejemplo n.º 5
0
		public virtual void VisitBinaryExpression (BinaryExpression node)
		{
			Visit (node.Left);
			Visit (node.Right);
		}