mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Go: Refactor SummarizedCallable.
Equivalent of https://github.com/github/codeql/pull/9210
This commit is contained in:
@@ -12,7 +12,7 @@ private newtype TNode =
|
||||
MkGlobalFunctionNode(Function f) or
|
||||
MkSummarizedParameterNode(DataFlowCallable c, int i) {
|
||||
not exists(c.getFuncDef()) and
|
||||
c instanceof SummarizedCallable and
|
||||
c.asCallable() instanceof SummarizedCallable and
|
||||
(
|
||||
i in [0 .. c.getType().getNumParameter() - 1]
|
||||
or
|
||||
@@ -115,7 +115,7 @@ module Public {
|
||||
exists(DataFlowCallable dfc | result = dfc.asCallable() |
|
||||
this = MkSummarizedParameterNode(dfc, _)
|
||||
or
|
||||
this = MkSummaryInternalNode(dfc, _)
|
||||
this = MkSummaryInternalNode(dfc.asCallable(), _)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ private module FlowSummaries {
|
||||
private import semmle.go.dataflow.FlowSummary as F
|
||||
}
|
||||
|
||||
class SummarizedCallableBase = Callable;
|
||||
|
||||
DataFlowCallable inject(SummarizedCallable c) { result.asCallable() = c }
|
||||
|
||||
/** Holds if `i` is a valid parameter position. */
|
||||
predicate parameterPosition(int i) {
|
||||
i = [-1 .. any(DataFlowCallable c).getType().getNumParameter()]
|
||||
@@ -87,7 +91,7 @@ DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) { none() }
|
||||
* `input`, output specification `output`, kind `kind`, and a flag `generated`
|
||||
* stating whether the summary is autogenerated.
|
||||
*/
|
||||
predicate summaryElement(DataFlowCallable c, string input, string output, string kind, boolean generated) {
|
||||
predicate summaryElement(Callable c, string input, string output, string kind, boolean generated) {
|
||||
exists(
|
||||
string namespace, string type, boolean subtypes, string name, string signature, string ext
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user