本文整理汇总了C#中BinaryExpressionSyntax.Update方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryExpressionSyntax.Update方法的具体用法?C# BinaryExpressionSyntax.Update怎么用?C# BinaryExpressionSyntax.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryExpressionSyntax
的用法示例。
在下文中一共展示了BinaryExpressionSyntax.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitBinaryExpression
protected override SyntaxNode VisitBinaryExpression(BinaryExpressionSyntax node)
{
var nameSyntax = FindIdentifierName (node.Left);
if (nameSyntax == null)
return base.VisitBinaryExpression (node);
switch (node.Kind)
{
case SyntaxKind.AddAssignExpression:
case SyntaxKind.OrAssignExpression:
case SyntaxKind.SubtractAssignExpression:
case SyntaxKind.MultiplyAssignExpression:
case SyntaxKind.DivideAssignExpression:
case SyntaxKind.ModuloAssignExpression:
case SyntaxKind.RightShiftAssignExpression:
case SyntaxKind.LeftShiftAssignExpression:
case SyntaxKind.AndAssignExpression:
case SyntaxKind.ExclusiveOrAssignExpression:
var token = Syntax.Token (GetComplexAssignOperator (node.Kind));
ExpressionSyntax expr = Syntax.ParseExpression (nameSyntax.PlainName + token + node.Right);
return node.Update (node.Left, AssignToken, GetLogExpression (nameSyntax.PlainName, expr));
case SyntaxKind.AssignExpression:
return node.Update (node.Left, node.OperatorToken, GetLogExpression (nameSyntax.PlainName, node.Right));
default:
return base.VisitBinaryExpression (node);
}
}
示例2: VisitBinaryExpression
/// <summary>
/// Normalizes the <paramref name="binaryExpression" />.
/// </summary>
public override SyntaxNode VisitBinaryExpression(BinaryExpressionSyntax binaryExpression)
{
if (!IsFormulaType(binaryExpression))
return base.VisitBinaryExpression(binaryExpression);
var left = ReplaceImplicitConversion(binaryExpression.Left);
var right = ReplaceImplicitConversion(binaryExpression.Right);
return binaryExpression.Update(left, binaryExpression.OperatorToken, right);
}
示例3: VisitBinaryExpression
/// <summary>
/// Normalizes the <paramref name="binaryExpression" />.
/// </summary>
public override SyntaxNode VisitBinaryExpression(BinaryExpressionSyntax binaryExpression)
{
var expressionType = DetermineType(binaryExpression);
if (expressionType == ExpressionType.Other)
return base.VisitBinaryExpression(binaryExpression);
var left = ReplaceImplicitConversion(expressionType, binaryExpression.Left);
var right = ReplaceImplicitConversion(expressionType, binaryExpression.Right);
return binaryExpression.Update(left, binaryExpression.OperatorToken, right);
}