C# Class ICSharpCode.NRefactory.CSharp.CSharpUtil

Exibir arquivo Open project: 0xd4d/NRefactory

Public Methods

Method Description
AreConditionsEqual ( Expression cond1, Expression cond2 ) : bool
GetInnerMostExpression ( Expression target ) : Expression
InvertCondition ( Expression condition ) : Expression

Inverts a boolean condition. Note: The condition object can be frozen (from AST) it's cloned internally.

IsRelationalOperator ( BinaryOperatorType op ) : bool

Returns true, if the specified operator is a relational operator

NegateConditionOperator ( BinaryOperatorType op ) : BinaryOperatorType

Get negation of the condition operator

NegateRelationalOperator ( BinaryOperatorType op ) : BinaryOperatorType

Get negation of the specified relational operator

Private Methods

Method Description
AddParensForUnaryExpressionIfRequired ( Expression expression ) : Expression

When negating an expression this is required, otherwise you would end up with a or b -> !a or b

InvertConditionInternal ( Expression condition ) : Expression

Method Details

AreConditionsEqual() public static method

public static AreConditionsEqual ( Expression cond1, Expression cond2 ) : bool
cond1 Expression
cond2 Expression
return bool

GetInnerMostExpression() public static method

public static GetInnerMostExpression ( Expression target ) : Expression
target Expression
return Expression

InvertCondition() public static method

Inverts a boolean condition. Note: The condition object can be frozen (from AST) it's cloned internally.
public static InvertCondition ( Expression condition ) : Expression
condition Expression The condition to invert.
return Expression

IsRelationalOperator() public static method

Returns true, if the specified operator is a relational operator
public static IsRelationalOperator ( BinaryOperatorType op ) : bool
op BinaryOperatorType
return bool

NegateConditionOperator() public static method

Get negation of the condition operator
public static NegateConditionOperator ( BinaryOperatorType op ) : BinaryOperatorType
op BinaryOperatorType
return BinaryOperatorType

NegateRelationalOperator() public static method

Get negation of the specified relational operator
public static NegateRelationalOperator ( BinaryOperatorType op ) : BinaryOperatorType
op BinaryOperatorType
return BinaryOperatorType