本文整理汇总了C#中PrefixUnaryExpressionSyntax.Kind方法的典型用法代码示例。如果您正苦于以下问题:C# PrefixUnaryExpressionSyntax.Kind方法的具体用法?C# PrefixUnaryExpressionSyntax.Kind怎么用?C# PrefixUnaryExpressionSyntax.Kind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrefixUnaryExpressionSyntax
的用法示例。
在下文中一共展示了PrefixUnaryExpressionSyntax.Kind方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitPrefixUnaryExpression
public override void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
if (node.Kind() != SyntaxKind.LogicalNotExpression)
{
throw new InvalidPreprocessorExpressionException("Expected logical not expression");
}
node.Operand.Accept(this);
}
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-codeformatter-dotnet,代码行数:9,代码来源:PreprocessorSymbolTracker.cs
示例2: VisitPrefixUnaryExpression
public override SyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
if (node.Kind() != SyntaxKind.LogicalNotExpression)
{
throw new InvalidPreprocessorExpressionException("Expected logical not expression");
}
var newExpression = (ExpressionSyntax)node.Operand.Accept(this);
if (newExpression.Kind() == SyntaxKind.LogicalNotExpression)
{
return ((PrefixUnaryExpressionSyntax)newExpression).Operand
.WithLeadingTrivia(node.GetLeadingTrivia())
.WithTrailingTrivia(node.GetTrailingTrivia());
}
else
{
return node.Operand != newExpression ?
node.WithOperand(newExpression) : node;
}
}
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-codeformatter-dotnet,代码行数:20,代码来源:PreprocessorExpressionSimplifier.cs
示例3: InferTypeInPrefixUnaryExpression
private IEnumerable<ITypeSymbol> InferTypeInPrefixUnaryExpression(PrefixUnaryExpressionSyntax prefixUnaryExpression, SyntaxToken? previousToken = null)
{
// If we have a position, then we must be after the prefix token.
Contract.ThrowIfTrue(previousToken.HasValue && previousToken.Value != prefixUnaryExpression.OperatorToken);
switch (prefixUnaryExpression.Kind())
{
case SyntaxKind.PreDecrementExpression:
case SyntaxKind.PreIncrementExpression:
case SyntaxKind.UnaryPlusExpression:
case SyntaxKind.UnaryMinusExpression:
case SyntaxKind.BitwiseNotExpression:
// ++, --, +Foo(), -Foo(), ~Foo();
return SpecializedCollections.SingletonEnumerable(this.Compilation.GetSpecialType(SpecialType.System_Int32));
case SyntaxKind.LogicalNotExpression:
// !Foo()
return SpecializedCollections.SingletonEnumerable(this.Compilation.GetSpecialType(SpecialType.System_Boolean));
}
return SpecializedCollections.EmptyEnumerable<ITypeSymbol>();
}
示例4: VisitPrefixUnaryExpression
public override SyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
node = (PrefixUnaryExpressionSyntax)base.VisitPrefixUnaryExpression(node);
if (transformKind == TransformKind.PrefixToPostfix)
{
var operatorToken = node.OperatorToken;
var operand = node.Operand;
var newOperatorToken = SyntaxFactory.Token(SyntaxFactory.TriviaList(SyntaxFactory.ElasticMarker), operatorToken.Kind(), operand.GetTrailingTrivia());
var newOperand = operand.WithTrailingTrivia(operatorToken.TrailingTrivia);
newOperand = newOperand.WithLeadingTrivia(operatorToken.LeadingTrivia);
if (node.Kind() == SyntaxKind.PreIncrementExpression)
{
return SyntaxFactory.PostfixUnaryExpression(SyntaxKind.PostIncrementExpression, newOperand, newOperatorToken);
}
if (node.Kind() == SyntaxKind.PreDecrementExpression)
{
return SyntaxFactory.PostfixUnaryExpression(SyntaxKind.PostDecrementExpression, newOperand, newOperatorToken);
}
}
return node;
}