Instruction.extended_previous_instructions()

Returns the set of all instructions which could be executed before the current instruction

extended_previous_instructions() → APISet[Instruction]

The difference between the extended_previous_instructions() function and previous_instructions() is that this function works in an recursive (inter-procedural) manner and returns all instructions following the current instruction in the CFG (control-flow-graph).

The function is recursive (intra-procedural), and follows function calls; for the non-recursive (intra-procedural) variant of this function, use previous_instructions().

For example, in the function:

function approve(address spender, uint256 amount) public override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

for the instruction:

return true;

the function will return instructions from _approve() and _msgSender().

Query Example

from glider import *
def query():

  instructions = Functions().with_name("approve").exec(1, 9).instructions().exec(1,1)
  
  return instructions + list(instructions.extended_next_instructions())

Output Example

The function returns APISet, instead of APIList, in case the result of the function is used as the return value of the query it must be casted to list()

Last updated