Instruction.next_instruction()
Returns a list of immediate following instructions in the control flow graph.
next_instruction() → APISet[Instruction]
The difference between the next_instruction() function and next_instructions() is that this function will return a list of instructions that are immediately following the current instruction in the CFG (control-flow-graph).
The function operates non-recursively, meaning it works intra-procedurally.
For example, in the function:
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}for the instruction:
uint256 c = a + b;the function will return the instruction:
require(c >= a, "SafeMath: addition overflow");Query Example
from glider import *
def query():
instructions = Functions().with_name("sub").exec(1,1).instructions().exec(1,1)
return instructions + instructions[0].next_instruction()Example Output

Last updated