Skip to content

Commit 52cc611

Browse files
committed
Use CallExpr.hasImplicitArgs()
1 parent b928f13 commit 52cc611

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ private newtype TNode =
1010
MkInstructionNode(IR::Instruction insn) or
1111
MkSsaNode(SsaDefinition ssa) or
1212
MkGlobalFunctionNode(Function f) or
13-
MkImplicitVarargsSlice(CallExpr c) { c.getTarget().isVariadic() and not c.hasEllipsis() } or
13+
MkImplicitVarargsSlice(CallExpr c) { c.hasImplicitVarargs() } or
1414
MkSummarizedParameterNode(SummarizedCallable c, int i) {
1515
FlowSummaryImpl::Private::summaryParameterNodeRange(c, i)
1616
} or
@@ -572,13 +572,9 @@ module Public {
572572
* predicate `getArgument` on `CallExpr`, which gets the syntactic arguments.
573573
*/
574574
Node getArgument(int i) {
575-
exists(SignatureType t, int lastParamIndex |
576-
t = this.getACalleeIncludingExternals().getType() and
577-
lastParamIndex = t.getNumParameter() - 1
578-
|
575+
exists(int lastParamIndex | lastParamIndex = expr.getCalleeType().getNumParameter() - 1 |
579576
if
580-
not this.hasEllipsis() and
581-
t.isVariadic() and
577+
expr.hasImplicitVarargs() and
582578
i >= lastParamIndex
583579
then
584580
result.(ImplicitVarargsSlice).getCallNode() = this and
@@ -598,11 +594,10 @@ module Public {
598594
* the varargs parameter of the target of this call (if there is one).
599595
*/
600596
Node getImplicitVarargsArgument(int i) {
601-
not this.hasEllipsis() and
602597
i >= 0 and
603-
exists(Function f | f = this.getTarget() |
604-
f.isVariadic() and
605-
result = this.getSyntacticArgument(f.getNumParameter() - 1 + i)
598+
expr.hasImplicitVarargs() and
599+
exists(int lastParamIndex | lastParamIndex = expr.getCalleeType().getNumParameter() - 1 |
600+
result = this.getSyntacticArgument(lastParamIndex + i)
606601
)
607602
}
608603

0 commit comments

Comments
 (0)