NegateBinaryExpression() приватный статический Метод

private static NegateBinaryExpression ( Expression expression, TypeSystem typeSystem ) : Expression
expression Expression
typeSystem TypeSystem
Результат Expression
Пример #1
0
		private static Expression NegateUnaryExpression(Expression expression, TypeSystem typeSystem)
		{
			V_0 = (UnaryExpression)expression;
			V_1 = V_0.get_Operator();
			if (V_1 == 1)
			{
				V_0.set_Operator(11);
				return V_0;
			}
			if (V_1 != 8 && V_1 != 11)
			{
				throw new ArgumentException("expression");
			}
			if (V_0.get_Operand().get_CodeNodeType() == 24)
			{
				V_2 = Negator.NegateBinaryExpression(V_0.get_Operand() as BinaryExpression, typeSystem);
				V_0.set_Operand(V_2);
				return V_0;
			}
			if (V_0.get_Operand().get_CodeNodeType() != 23 || (V_0.get_Operand() as UnaryExpression).get_Operator() != 1)
			{
				V_0.set_Operator(1);
			}
			else
			{
				V_0.set_Operand((V_0.get_Operand() as UnaryExpression).get_Operand());
			}
			return V_0;
		}
Пример #2
0
		public static Expression Negate(Expression expression, TypeSystem typeSystem)
		{
			if (expression == null)
			{
				return null;
			}
			V_1 = expression.get_CodeNodeType();
			if (V_1 == 23)
			{
				return Negator.NegateUnaryExpression(expression, typeSystem);
			}
			if (V_1 == 24)
			{
				V_2 = (BinaryExpression)expression;
				if (!Negator.IsMathOperator(V_2.get_Operator()))
				{
					return Negator.NegateBinaryExpression(expression, typeSystem);
				}
				if (String.op_Equality(V_2.get_ExpressionType().get_FullName(), "System.Boolean"))
				{
					return new UnaryExpression(1, expression, null);
				}
				return new BinaryExpression(9, expression, new LiteralExpression((object)0, typeSystem, null), typeSystem, null, false);
			}
			if (V_1 == 36)
			{
				return Negator.NegateConditionExpression(expression, typeSystem);
			}
			if (expression.get_CodeNodeType() == 22 && String.op_Equality(expression.get_ExpressionType().get_FullName(), typeSystem.get_Boolean().get_FullName()))
			{
				return new LiteralExpression((object)(!(Boolean)(expression as LiteralExpression).get_Value()), typeSystem, expression.get_UnderlyingSameMethodInstructions());
			}
			V_0 = expression.get_ExpressionType().GetDefaultValueExpression(typeSystem) as LiteralExpression;
			if (V_0 == null)
			{
				return new UnaryExpression(1, expression, null);
			}
			if (String.op_Equality(V_0.get_ExpressionType().get_FullName(), typeSystem.get_Boolean().get_FullName()))
			{
				return new UnaryExpression(1, expression, null);
			}
			return new BinaryExpression(9, expression, V_0, typeSystem, null, false);
		}