public static List<LdcInsnNode> ldcFor(MethodInsnNode node) { AbstractInsnNode it = new Insn<>(null, node.getPrevious()) .prev() .filter(is(MethodInsnNode.class)) .findFirst() .orElseGet(() -> Insn.first(node)); /** Collect all ldc between a previous method invocation and current invocation: */ List<LdcInsnNode> ldc = new ArrayList<>(); while (it != node) { if (it instanceof LdcInsnNode) { ldc.add((LdcInsnNode) it); } it = it.getNext(); } return ldc; } }
p = p.getNext();
static String getDescriptionForTypeInsnNode(TypeInsnNode typeInsnNode) { AbstractInsnNode nextInsn = typeInsnNode.getNext(); StringJoiner argsDesc = new StringJoiner(",", "(", ")"); while (nextInsn != null) { if (nextInsn instanceof LdcInsnNode) { argsDesc.add("_"); } else if (nextInsn.getOpcode() == Opcodes.DUP) { //ignore } else { break; } nextInsn = nextInsn.getNext(); } if (typeInsnNode.getOpcode() == Opcodes.NEW) { return "new " + Util.extractSimpleName(typeInsnNode.desc, "/") + argsDesc.toString(); } return ""; } }
private void initParentCount(int[] parentCount) { parentCount[0] = 1; for (AbstractInsnNode p = insnList.getFirst(); p != null; p = p.getNext()) { if (p.getType() == AbstractInsnNode.JUMP_INSN) { JumpInsnNode jump = (JumpInsnNode) p; AbstractInsnNode next = p.getNext(); if(next!=null) { parentCount[insnList.indexOf(p.getNext())]++;
for (AbstractInsnNode p = m.instructions.getFirst(); p != null; p = p.getNext()) { if (p.getOpcode() == Opcodes.INVOKESTATIC) { MethodInsnNode mn = (MethodInsnNode) p;
private List<RouteParameter> params(final ClassLoader loader, final ClassNode owner, final String pattern, final MethodNode lambda) { List<RouteParameter> result = new ArrayList<>(); new Insns(lambda) .on(param(loader), it -> { String name = parameterName(it.node) .orElse("arg" + result.size()); AbstractInsnNode next = it.node.getNext(); Object value = paramValue(loader, owner, lambda, next); if (value != next) { // there is a default value, move next next = next.getNext(); } else { value = null; } java.lang.reflect.Type parameterType = parameterType(loader, next); // boolean are ICONST_0 or ICONST_1 if (boolean.class.equals(parameterType) && Integer.class.isInstance(value)) { value = (((Integer) value)).intValue() == 1; } result.add(new RouteParameter(name, kind(pattern, it.node.name, name), simplifyType(parameterType), value)); }).forEach(); return result; }
AbstractInsnNode next = n.getNext(); if (next instanceof MethodInsnNode) { if (((MethodInsnNode) next).name.equals("toOptional")) {
stack.push(p.getNext()); merge(tmp, index + 1);
handlers.set(handlerIdx); for (AbstractInsnNode p = tcb.start.getNext(); p != tcb.end; p = p.getNext()) {
public void step() { if (this.currentInsnNode != null) { this.currentInsnNode = this.currentInsnNode.getNext(); } }
public void ignore(final AbstractInsnNode fromInclusive, final AbstractInsnNode toInclusive) { for (AbstractInsnNode i = fromInclusive; i != toInclusive; i = i .getNext()) { ignored.add(i); } ignored.add(toInclusive); }
public void filter(final MethodNode methodNode, final IFilterContext context, final IFilterOutput output) { AbstractInsnNode i = methodNode.instructions.getFirst(); while (i != null) { filter(i, output); i = i.getNext(); } }
@Override public void accept(final MethodVisitor mv) { currentInsn = inner.getFirst(); while (currentInsn != null) { currentFrame = frames[index]; nextFrame = index + 1 < frames.length ? frames[index + 1] : null; currentInsn.accept(mv); currentInsn = currentInsn.getNext(); index++; } }
public void filter(final MethodNode methodNode, final IFilterContext context, final IFilterOutput output) { final Matcher matcher = new Matcher(); for (AbstractInsnNode i = methodNode.instructions .getFirst(); i != null; i = i.getNext()) { matcher.match(i, output); } }
private static AbstractInsnNode next(AbstractInsnNode i) { do { i = i.getNext(); } while (i != null && (AbstractInsnNode.FRAME == i.getType() || AbstractInsnNode.LABEL == i.getType() || AbstractInsnNode.LINE == i.getType())); return i; }
public void process(ParserClassNode classNode, RuleMethod method) throws Exception { checkArgNotNull(classNode, "classNode"); checkArgNotNull(method, "method"); InsnList instructions = method.instructions; AbstractInsnNode insn = instructions.getFirst(); while (insn.getOpcode() != ARETURN) { if (insn.getOpcode() == INVOKESPECIAL) { process(classNode, method, (MethodInsnNode) insn); } insn = insn.getNext(); } }