-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathUnary.cs
More file actions
36 lines (31 loc) · 1.07 KB
/
Unary.cs
File metadata and controls
36 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.IO;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Semmle.Extraction.Kinds;
namespace Semmle.Extraction.CSharp.Entities.Expressions
{
internal class Unary : Expression<PrefixUnaryExpressionSyntax>
{
private Unary(ExpressionNodeInfo info, ExprKind kind)
: base(info.SetKind(UnaryOperatorKind(info.Context, info.Kind, info.Node)))
{
operatorKind = kind;
}
private readonly ExprKind operatorKind;
public static Unary Create(ExpressionNodeInfo info)
{
var ret = new Unary(info, info.Kind);
ret.TryPopulate();
return ret;
}
protected override void PopulateExpression(TextWriter trapFile)
{
Create(Context, Syntax.Operand, this, 0);
AddOperatorCall(trapFile, Syntax);
if ((operatorKind == ExprKind.PRE_INCR || operatorKind == ExprKind.PRE_DECR) &&
Kind == ExprKind.OPERATOR_INVOCATION)
{
trapFile.mutator_invocation_mode(this, 1);
}
}
}
}