Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 1580591

Browse files
committed
Address review comments
1 parent e7095ba commit 1580591

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

ql/src/semmle/go/dataflow/FunctionInputsAndOutputs.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private class ResultInput extends FunctionInput, TInResult {
101101
override predicate isResult() { index = -1 }
102102

103103
override predicate isResult(int i) {
104-
index = -1 and i = 0
104+
i = 0 and isResult()
105105
or
106106
i = index and i >= 0
107107
}
@@ -186,7 +186,7 @@ private class OutResult extends FunctionOutput, TOutResult {
186186
override predicate isResult() { index = -1 }
187187

188188
override predicate isResult(int i) {
189-
index = -1 and i = 0
189+
i = 0 and isResult()
190190
or
191191
i = index and i >= 0
192192
}

ql/src/semmle/go/dataflow/internal/DataFlowUtil.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,12 @@ class CallNode extends ExprNode {
327327
/** Gets a function passed as the `i`th argument of this call. */
328328
FunctionNode getCallback(int i) { result.getASuccessor*() = this.getArgument(i) }
329329

330-
/** Gets the data-flow node corresponding to the `i`th result of this call. */
330+
/**
331+
* Gets the data-flow node corresponding to the `i`th result of this call.
332+
*
333+
* If there is a single result then it is considered to be the 0th result. */
331334
Node getResult(int i) {
332-
not getType() instanceof TupleType and i = 0 and result = this
335+
i = 0 and result = getResult()
333336
or
334337
result = extractTupleElement(this, i)
335338
}

0 commit comments

Comments
 (0)