本文整理汇总了C#中PrefixUnaryExpressionSyntax类的典型用法代码示例。如果您正苦于以下问题:C# PrefixUnaryExpressionSyntax类的具体用法?C# PrefixUnaryExpressionSyntax怎么用?C# PrefixUnaryExpressionSyntax使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrefixUnaryExpressionSyntax类属于命名空间,在下文中一共展示了PrefixUnaryExpressionSyntax类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: GetExpression
private static void GetExpression(PrefixUnaryExpressionSyntax prefix, out ExpressionSyntax expression, out uint count)
{
count = 0;
var currentUnary = prefix;
do
{
count++;
expression = currentUnary.Operand;
currentUnary = currentUnary.Operand as PrefixUnaryExpressionSyntax;
}
while (currentUnary != null);
}
示例3: VisitPrefixUnaryExpression
public override SyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
switch (node.Kind)
{
case SyntaxKind.PreIncrementExpression:
return Syntax.BinaryExpression(SyntaxKind.AddAssignExpression, node.Operand, Syntax.LiteralExpression(SyntaxKind.NumericLiteralExpression, Syntax.Literal(1)));
case SyntaxKind.PreDecrementExpression:
return Syntax.BinaryExpression(SyntaxKind.SubtractAssignExpression, node.Operand, Syntax.LiteralExpression(SyntaxKind.NumericLiteralExpression, Syntax.Literal(1)));
case SyntaxKind.NegateExpression:
if (node.Operand.Kind == SyntaxKind.NumericLiteralExpression)
{
dynamic newvalue = -((dynamic)((LiteralExpressionSyntax)node.Operand).Token.Value);
return Syntax.LiteralExpression(SyntaxKind.NumericLiteralExpression, Syntax.Literal(newvalue));
}
return node;
}
throw new NotImplementedException("Unary prefix " + node.Kind.ToString());
}
示例4: VisitPrefixUnaryExpression
public override SyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
switch (node.CSharpKind())
{
case SyntaxKind.PreIncrementExpression:
return SyntaxFactory.BinaryExpression(SyntaxKind.AddAssignmentExpression, node.Operand, SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(1)));
case SyntaxKind.PreDecrementExpression:
return SyntaxFactory.BinaryExpression(SyntaxKind.SubtractAssignmentExpression, node.Operand, SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(1)));
#if NEGATE_EXPRESSION
case SyntaxKind.NegateExpression:
if (node.Operand.CSharpKind() == SyntaxKind.NumericLiteralExpression)
{
dynamic newvalue = -((dynamic)((LiteralExpressionSyntax)node.Operand).Token.Value);
return SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(newvalue));
}
return node;
#endif
case SyntaxKind.LogicalNotExpression:
return SyntaxFactory.BinaryExpression(SyntaxKind.NotEqualsExpression, node.Operand, SyntaxFactory.LiteralExpression(SyntaxKind.TrueLiteralExpression));
}
throw new NotImplementedException("Unary prefix " + node.CSharpKind().ToString());
}
示例5: VisitPrefixUnaryExpression
public virtual void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
DefaultVisit(node);
}
示例6: TopLevelUnaryInChain
private static bool TopLevelUnaryInChain(PrefixUnaryExpressionSyntax unary)
{
var parent = unary.Parent as PrefixUnaryExpressionSyntax;
return parent == null || !SameOperators(parent, unary);
}
示例7: PrefixUnaryExpressionTranslation
public PrefixUnaryExpressionTranslation(PrefixUnaryExpressionSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
{
Operand = syntax.Operand.Get<ExpressionTranslation>(this);
}
示例8: RewriteExpression
/// <summary>
/// Rewrites the expression with a nondetermnistic choice expression.
/// </summary>
/// <param name="node">PrefixUnaryExpressionSyntax</param>
/// <returns>SyntaxNode</returns>
private SyntaxNode RewriteExpression(PrefixUnaryExpressionSyntax node)
{
var text = "this.Nondet()";
var rewritten = SyntaxFactory.ParseExpression(text);
return rewritten;
}
示例9: GetAwaitExpressionInfo
public override AwaitExpressionInfo GetAwaitExpressionInfo(PrefixUnaryExpressionSyntax node)
{
using (Logger.LogBlock(FunctionId.CSharp_SemanticModel_GetAwaitExpressionInfo, message: this.SyntaxTree.FilePath))
{
MemberSemanticModel memberModel = GetMemberModel(node);
return memberModel == null ? default(AwaitExpressionInfo) : memberModel.GetAwaitExpressionInfo(node);
}
}
示例10: VisitPrefixUnaryExpression
public override void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
base.VisitPrefixUnaryExpression(node);
if (node.IsKind(SyntaxKind.AddressOfExpression) || node.IsKind(SyntaxKind.PointerIndirectionExpression)) // TODO: Check
MarkUnsafe();
}
示例11: PrefixUnaryExpression
public static string PrefixUnaryExpression(PrefixUnaryExpressionSyntax expression)
{
return expression.OperatorToken.Text + SyntaxNode(expression.Operand);
}
示例12: VisitPrefixUnaryExpression
public override SyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
if (IsPropertyAccess(node.Operand))
this.AppendCompileIssue(node, IssueType.Error, IssueId.PropertyAccessIssue);
_output.Write(node, node.OperatorToken.ValueText);
this.Visit(node.Operand);
return node;
}
示例13: VisitPrefixUnaryExpression
protected override SyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
IdentifierNameSyntax name = node.Operand as IdentifierNameSyntax;
if (name != null)
{
switch (node.Kind)
{
case SyntaxKind.PreIncrementExpression:
case SyntaxKind.PreDecrementExpression:
return GetLogExpression (name.PlainName, node);
}
}
return base.VisitPrefixUnaryExpression (node);
}
示例14: VisitPrefixUnaryExpression
public override SyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node)
{
var based = base.VisitPrefixUnaryExpression (node);
switch (node.Kind)
{
case SyntaxKind.PreIncrementExpression:
case SyntaxKind.PreDecrementExpression:
return based.WithTrailingTrivia (based.GetTrailingTrivia().Prepend (GetIdComment()));
default:
return based;
}
}
示例15: AddPrefixUnaryExpressionTerms
private static void AddPrefixUnaryExpressionTerms(PrefixUnaryExpressionSyntax prefixUnaryExpression, IList<string> terms, ref ExpressionType expressionType)
{
expressionType = ExpressionType.Invalid;
var flags = ExpressionType.Invalid;
// Ask our subexpression for terms
AddSubExpressionTerms(prefixUnaryExpression.Operand, terms, ref flags);
// Is our expression a valid term?
AddIfValidTerm(prefixUnaryExpression.Operand, flags, terms);
if (prefixUnaryExpression.IsKind(SyntaxKind.LogicalNotExpression, SyntaxKind.BitwiseNotExpression, SyntaxKind.UnaryMinusExpression, SyntaxKind.UnaryPlusExpression))
{
// We're a valid expression if our subexpression is...
expressionType = flags & ExpressionType.ValidExpression;
}
}