From 4fb714f4452569691c2fad0ee1e84d47904b3392 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 21 Apr 2021 12:33:00 +0100 Subject: [PATCH] Simplify implementation of ExtractTupleElementInstruction.getResultType --- ql/src/semmle/go/controlflow/IR.qll | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/ql/src/semmle/go/controlflow/IR.qll b/ql/src/semmle/go/controlflow/IR.qll index ec25b62ad69..c85d69ee45c 100644 --- a/ql/src/semmle/go/controlflow/IR.qll +++ b/ql/src/semmle/go/controlflow/IR.qll @@ -747,20 +747,8 @@ module IR { result = c.getTarget().getResultType(i) ) or - exists(TypeAssertExpr tae | this.getBase() = evalExprInstruction(tae) | - result = tae.getType().(TupleType).getComponentType(pragma[only_bind_into](i)) - ) - or - exists(Instruction mapBase | this.getBase().readsElement(mapBase, _) | - i = 0 and result = mapBase.getResultType().getUnderlyingType().(MapType).getValueType() - or - i = 1 and result = any(BoolExprType b) - ) - or - exists(RecvExpr re | this.getBase() = evalExprInstruction(re) | - i = 0 and result = re.getOperand().getType().getUnderlyingType().(ChanType).getElementType() - or - i = 1 and result = any(BoolExprType b) + exists(Expr e | this.getBase() = evalExprInstruction(e) | + result = e.getType().(TupleType).getComponentType(pragma[only_bind_into](i)) ) or exists(Type rangeType | rangeType = s.(RangeStmt).getDomain().getType().getUnderlyingType() |