本文整理汇总了C#中UnaryOperatorExpression.ReplaceWith方法的典型用法代码示例。如果您正苦于以下问题:C# UnaryOperatorExpression.ReplaceWith方法的具体用法?C# UnaryOperatorExpression.ReplaceWith怎么用?C# UnaryOperatorExpression.ReplaceWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnaryOperatorExpression
的用法示例。
在下文中一共展示了UnaryOperatorExpression.ReplaceWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitUnaryOperatorExpression
public override void VisitUnaryOperatorExpression(UnaryOperatorExpression unary)
{
base.VisitUnaryOperatorExpression (unary);
Identifier identifier = unary.FindIdentifier();
if (identifier == null)
return;
switch (unary.Operator)
{
case UnaryOperatorType.Increment:
case UnaryOperatorType.Decrement:
unary.ReplaceWith (GetAssignmentExpression (identifier, unary));
break;
case UnaryOperatorType.PostDecrement:
case UnaryOperatorType.PostIncrement:
var variable = new IdentifierExpression (identifier.Name);
var name = new PrimitiveExpression (identifier.Name);
unary.ReplaceWith (GetHookExpression ("LogPostfix", GetSubmissionId(), GetId(), unary.Clone(), name, variable));
break;
}
}
示例2: VisitUnaryOperatorExpression
public override void VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression)
{
base.VisitUnaryOperatorExpression(unaryOperatorExpression);
if (unaryOperatorExpression.Operator == UnaryOperatorType.Minus &&
unaryOperatorExpression.Expression is PrimitiveExpression &&
(dynamic)((PrimitiveExpression)unaryOperatorExpression.Expression).Value == 0)
unaryOperatorExpression.ReplaceWith(new PrimitiveExpression(0));
}