Instruction.extended_next_instructions()

Returns the set of all instructions following the current node in the control flow graph.

extended_next_instructions() → APISet[Instruction]

The difference between the extended_next_instructions() function and next_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 next_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:

_approve(_msgSender(), spender, amount);

the function will return instructions from _approve().

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