diff --git a/ql/src/semmle/go/controlflow/ControlFlowGraphImpl.qll b/ql/src/semmle/go/controlflow/ControlFlowGraphImpl.qll index bf1d1aef15e..018789c8ff8 100644 --- a/ql/src/semmle/go/controlflow/ControlFlowGraphImpl.qll +++ b/ql/src/semmle/go/controlflow/ControlFlowGraphImpl.qll @@ -61,6 +61,7 @@ private predicate isCond(Expr e) { * respectively, of the execution of the function and the loading of the file; * - Skip nodes that are semantic no-ops, but make CFG construction easier. */ +cached newtype TControlFlowNode = /** * A control-flow node that represents the evaluation of an expression. diff --git a/ql/src/semmle/go/controlflow/IR.qll b/ql/src/semmle/go/controlflow/IR.qll index 95270055d18..fb984f0041e 100644 --- a/ql/src/semmle/go/controlflow/IR.qll +++ b/ql/src/semmle/go/controlflow/IR.qll @@ -654,15 +654,15 @@ module IR { } /** Holds if this extracts the `idx`th value of the result of `base`. */ - predicate extractsElement(Instruction base, int idx) { base = getBase() and idx = i } + predicate extractsElement(Instruction base, int idx) { base = this.getBase() and idx = i } override Type getResultType() { - exists(CallExpr c | getBase() = evalExprInstruction(c) | + exists(CallExpr c | this.getBase() = evalExprInstruction(c) | result = c.getTarget().getResultType(i) ) or - exists(TypeAssertExpr tae | getBase() = evalExprInstruction(tae) | - result = tae.getType().(TupleType).getComponentType(i) + exists(TypeAssertExpr tae | this.getBase() = evalExprInstruction(tae) | + result = tae.getType().(TupleType).getComponentType(pragma[only_bind_into](i)) ) or exists(Type rangeType | rangeType = s.(RangeStmt).getDomain().getType().getUnderlyingType() |