Exemplo n.º 1
0
 // marked return could be either non-local or local in case of labeled lambda self-returns
 public static boolean isMarkedReturn(@NotNull AbstractInsnNode returnIns) {
   if (!isReturnOpcode(returnIns.getOpcode())) {
     return false;
   }
   AbstractInsnNode globalFlag = returnIns.getPrevious();
   return globalFlag instanceof MethodInsnNode
       && NON_LOCAL_RETURN.equals(((MethodInsnNode) globalFlag).owner);
 }
Exemplo n.º 2
0
 public static boolean isInlineMarker(AbstractInsnNode insn, String name) {
   if (insn instanceof MethodInsnNode) {
     MethodInsnNode methodInsnNode = (MethodInsnNode) insn;
     return insn.getOpcode() == Opcodes.INVOKESTATIC
         && methodInsnNode.owner.equals(INLINE_MARKER_CLASS_NAME)
         && (name != null
             ? methodInsnNode.name.equals(name)
             : methodInsnNode.name.equals(INLINE_MARKER_BEFORE_METHOD_NAME)
                 || methodInsnNode.name.equals(INLINE_MARKER_AFTER_METHOD_NAME));
   } else {
     return false;
   }
 }
Exemplo n.º 3
0
 public static int getConstant(AbstractInsnNode ins) {
   int opcode = ins.getOpcode();
   Integer value;
   if (opcode >= Opcodes.ICONST_0 && opcode <= Opcodes.ICONST_5) {
     value = opcode - Opcodes.ICONST_0;
   } else if (opcode == Opcodes.BIPUSH || opcode == Opcodes.SIPUSH) {
     IntInsnNode index = (IntInsnNode) ins;
     value = index.operand;
   } else {
     LdcInsnNode index = (LdcInsnNode) ins;
     value = (Integer) index.cst;
   }
   return value;
 }