Skip to content

Commit 654f2ae

Browse files
committed
C#: Address review comment
1 parent e808376 commit 654f2ae

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Expression.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,19 @@ public static ExprKind UnaryOperatorKind(Context cx, ExprKind originalKind, Expr
117117
public void OperatorCall(ExpressionSyntax node)
118118
{
119119
var @operator = cx.GetSymbolInfo(node);
120-
var method = @operator.Symbol as IMethodSymbol;
121-
122-
var callType = GetCallType(cx, node);
123-
if (callType == CallType.Dynamic)
120+
if (@operator.Symbol is IMethodSymbol method)
124121
{
125-
UserOperator.OperatorSymbol(method.Name, out string operatorName);
126-
cx.Emit(Tuples.dynamic_member_name(this, operatorName));
127-
return;
128-
}
129122

130-
if (callType != CallType.None)
123+
var callType = GetCallType(cx, node);
124+
if (callType == CallType.Dynamic)
125+
{
126+
UserOperator.OperatorSymbol(method.Name, out string operatorName);
127+
cx.Emit(Tuples.dynamic_member_name(this, operatorName));
128+
return;
129+
}
130+
131131
cx.Emit(Tuples.expr_call(this, Method.Create(cx, method)));
132+
}
132133
}
133134

134135
public enum CallType

0 commit comments

Comments
 (0)