Skip to content

Commit e70cb1f

Browse files
committed
Code quality improvement: simplify DataFlowPrivate::isParamsArg
1 parent 91637d4 commit e70cb1f

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -602,18 +602,6 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
602602
nodeTo.(ObjectCreationNode).getPreUpdateNode() = nodeFrom.(ObjectInitializerNode)
603603
}
604604

605-
pragma[noinline]
606-
private Expr getImplicitArgument(Call c, int pos) {
607-
result = c.getArgument(pos) and
608-
not exists(result.getExplicitArgumentName())
609-
}
610-
611-
pragma[nomagic]
612-
private Expr getExplicitArgument(Call c, string name) {
613-
result = c.getAnArgument() and
614-
result.getExplicitArgumentName() = name
615-
}
616-
617605
/**
618606
* Holds if `arg` is a `params` argument of `c`, for parameter `p`, and `arg` will
619607
* be wrapped in an array by the C# compiler.
@@ -624,11 +612,7 @@ private predicate isParamsArg(Call c, Expr arg, Parameter p) {
624612
p = target.getAParameter() and
625613
p.isParams() and
626614
numArgs = c.getNumberOfArguments() and
627-
arg =
628-
[
629-
getImplicitArgument(c, [p.getPosition() .. numArgs - 1]),
630-
getExplicitArgument(c, p.getName())
631-
]
615+
arg = c.getArgumentForParameter(p)
632616
|
633617
numArgs > target.getNumberOfParameters()
634618
or

0 commit comments

Comments
 (0)