Skip to content

Commit 282699e

Browse files
committed
Go: Refactor SummarizedCallable.
Equivalent of #9210
1 parent c768f04 commit 282699e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ private newtype TNode =
1212
MkGlobalFunctionNode(Function f) or
1313
MkSummarizedParameterNode(DataFlowCallable c, int i) {
1414
not exists(c.getFuncDef()) and
15-
c instanceof SummarizedCallable and
15+
c.asCallable() instanceof SummarizedCallable and
1616
(
1717
i in [0 .. c.getType().getNumParameter() - 1]
1818
or
@@ -115,7 +115,7 @@ module Public {
115115
exists(DataFlowCallable dfc | result = dfc.asCallable() |
116116
this = MkSummarizedParameterNode(dfc, _)
117117
or
118-
this = MkSummaryInternalNode(dfc, _)
118+
this = MkSummaryInternalNode(dfc.asCallable(), _)
119119
)
120120
}
121121

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ private module FlowSummaries {
1414
private import semmle.go.dataflow.FlowSummary as F
1515
}
1616

17+
class SummarizedCallableBase = Callable;
18+
19+
DataFlowCallable inject(SummarizedCallable c) { result.asCallable() = c }
20+
1721
/** Holds if `i` is a valid parameter position. */
1822
predicate parameterPosition(int i) {
1923
i = [-1 .. any(DataFlowCallable c).getType().getNumParameter()]
@@ -87,7 +91,7 @@ DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) { none() }
8791
* `input`, output specification `output`, kind `kind`, and a flag `generated`
8892
* stating whether the summary is autogenerated.
8993
*/
90-
predicate summaryElement(DataFlowCallable c, string input, string output, string kind, boolean generated) {
94+
predicate summaryElement(Callable c, string input, string output, string kind, boolean generated) {
9195
exists(
9296
string namespace, string type, boolean subtypes, string name, string signature, string ext
9397
|

0 commit comments

Comments
 (0)