in bytekit-core/src/main/java/com/alibaba/bytekit/asm/location/InvokeLocationMatcher.java [87:117]
public List<Location> match(MethodProcessor methodProcessor) {
if (this.atInvokeExcpetionExit) {
return matchForException(methodProcessor);
}
List<Location> locations = new ArrayList<Location>();
AbstractInsnNode insnNode = methodProcessor.getEnterInsnNode();
LocationFilter locationFilter = methodProcessor.getLocationFilter();
LocationType locationType = whenComplete ? LocationType.INVOKE_COMPLETED : LocationType.INVOKE;
int matchedCount = 0;
while (insnNode != null) {
if (insnNode instanceof MethodInsnNode) {
MethodInsnNode methodInsnNode = (MethodInsnNode) insnNode;
if (matchCall(methodInsnNode)) {
if(locationFilter.allow(methodInsnNode, locationType, this.whenComplete)) {
matchedCount++;
if (count <= 0 || count == matchedCount) {
InvokeLocation invokeLocation = new InvokeLocation(methodInsnNode, count, whenComplete);
locations.add(invokeLocation);
}
}
}
}
insnNode = insnNode.getNext();
}
return locations;
}