Skip to content

Commit 67b64f9

Browse files
committed
C#: Move the adjust kind to the Cast class.
1 parent b6ee366 commit 67b64f9

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,16 +263,6 @@ type.SpecialType is SpecialType.System_IntPtr ||
263263
return si.Symbol as IMethodSymbol;
264264
}
265265

266-
/// <summary>
267-
/// Adapt the operator kind depending on whether it's a dynamic call or a user-operator call.
268-
/// </summary>
269-
/// <param name="cx"></param>
270-
/// <param name="node"></param>
271-
/// <param name="originalKind"></param>
272-
/// <returns></returns>
273-
public static ExprKind UnaryOperatorKind(Context cx, ExprKind originalKind, ExpressionSyntax node) =>
274-
GetCallType(cx, node).AdjustKind(originalKind);
275-
276266
/// <summary>
277267
/// If the expression calls an operator, add an expr_call()
278268
/// to show the target of the call. Also note the dynamic method

csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Cast.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ internal class Cast : Expression<CastExpressionSyntax>
1010
private const int ExpressionIndex = 0;
1111
private const int TypeAccessIndex = 1;
1212

13-
private Cast(ExpressionNodeInfo info) : base(info.SetKind(UnaryOperatorKind(info.Context, ExprKind.CAST, info.Node))) { }
13+
private Cast(ExpressionNodeInfo info) : base(info.SetKind(GetKind(info.Context, ExprKind.CAST, info.Node))) { }
14+
15+
/// <summary>
16+
/// Adapt the operator kind depending on whether it's a dynamic call or a user-operator call.
17+
/// </summary>
18+
/// <param name="cx"></param>
19+
/// <param name="node"></param>
20+
/// <param name="originalKind"></param>
21+
/// <returns></returns>
22+
public static ExprKind GetKind(Context cx, ExprKind originalKind, ExpressionSyntax node) =>
23+
GetCallType(cx, node).AdjustKind(originalKind);
1424

1525
public static Expression Create(ExpressionNodeInfo info) => new Cast(info).TryPopulate();
1626

0 commit comments

Comments
 (0)