Skip to content

Commit 9f7c475

Browse files
committed
Expect "receiver" instead of "-1"
1 parent 557adaf commit 9f7c475

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,21 @@ private module FlowSummaries {
1515
private import semmle.go.dataflow.FlowSummary as F
1616
}
1717

18+
bindingset[pos]
19+
private string positionToString(int pos) {
20+
if pos = -1 then result = "receiver" else result = pos.toString()
21+
}
22+
1823
module Input implements InputSig<Location, DataFlowImplSpecific::GoDataFlow> {
1924
class SummarizedCallableBase = Callable;
2025

2126
ArgumentPosition callbackSelfParameterPosition() { result = -1 }
2227

2328
ReturnKind getStandardReturnValueKind() { result = getReturnKind(0) }
2429

25-
string encodeParameterPosition(ParameterPosition pos) { result = pos.toString() }
30+
string encodeParameterPosition(ParameterPosition pos) { result = positionToString(pos) }
2631

27-
string encodeArgumentPosition(ArgumentPosition pos) { result = pos.toString() }
32+
string encodeArgumentPosition(ArgumentPosition pos) { result = positionToString(pos) }
2833

2934
string encodeReturn(ReturnKind rk, string arg) {
3035
exists(int pos |

0 commit comments

Comments
 (0)