Package jadx.core.dex.nodes

Examples of jadx.core.dex.nodes.IContainer


        if (!(region instanceof Region)) {
          return;
        }

        for (Iterator<IContainer> it = region.getSubBlocks().iterator(); it.hasNext(); ) {
          IContainer container = it.next();
          if (container instanceof BlockNode) {
            BlockNode block = (BlockNode) container;
            if (block.getInstructions().isEmpty()) {
              try {
                it.remove();
View Full Code Here


  static boolean makeTernaryInsn(MethodNode mth, IfRegion ifRegion) {
    if (ifRegion.contains(AFlag.ELSE_IF_CHAIN)) {
      return false;
    }
    IContainer thenRegion = ifRegion.getThenRegion();
    IContainer elseRegion = ifRegion.getElseRegion();
    if (thenRegion == null || elseRegion == null) {
      return false;
    }
    BlockNode tb = getTernaryInsnBlock(thenRegion);
    BlockNode eb = getTernaryInsnBlock(elseRegion);
View Full Code Here

  private static BlockNode getTernaryInsnBlock(IContainer thenRegion) {
    if (thenRegion instanceof Region) {
      Region r = (Region) thenRegion;
      if (r.getSubBlocks().size() == 1) {
        IContainer container = r.getSubBlocks().get(0);
        if (container instanceof BlockNode) {
          BlockNode block = (BlockNode) container;
          if (block.getInstructions().size() == 1) {
            return block;
          }
View Full Code Here

    TryCatchRegion tryCatchRegion = new TryCatchRegion(region, tryRegion);
    tryRegion.setParent(tryCatchRegion);
    tryCatchRegion.setTryCatchBlock(tb.getCatchAttr().getTryBlock());

    // replace first node by region
    IContainer firstNode = tryRegion.getSubBlocks().get(0);
    if (!region.replaceSubBlock(firstNode, tryCatchRegion)) {
      return false;
    }
    subBlocks.removeAll(tryRegion.getSubBlocks());
View Full Code Here

    /**
     * Check that there are no code after this block in regions structure
     */
    private boolean noTrailInstructions(BlockNode block) {
      IContainer curContainer = block;
      for (IRegion region : regionStack) {
        // ignore paths on other branches
        if (region instanceof IfRegion
            || region instanceof SwitchRegion
            || region instanceof TryCatchRegion) {
          curContainer = region;
          continue;
        }
        List<IContainer> subBlocks = region.getSubBlocks();
        if (!subBlocks.isEmpty()) {
          ListIterator<IContainer> itSubBlock = subBlocks.listIterator(subBlocks.size());
          while (itSubBlock.hasPrevious()) {
            IContainer subBlock = itSubBlock.previous();
            if (subBlock == curContainer) {
              break;
            } else if (!isEmpty(subBlock)) {
              return false;
            }
View Full Code Here

        }
      }
      Set<BlockNode> regionsBlocks = new HashSet<BlockNode>(mth.getBasicBlocks().size());
      RegionUtils.getAllRegionBlocks(mth.getRegion(), regionsBlocks);
      for (ExceptionHandler handler : mth.getExceptionHandlers()) {
        IContainer handlerRegion = handler.getHandlerRegion();
        if (handlerRegion != null) {
          RegionUtils.getAllRegionBlocks(handlerRegion, regionsBlocks);
        }
      }
      for (BlockNode block : mth.getBasicBlocks()) {
View Full Code Here

      IfCondition condition = ifRegion.getCondition();
      if (condition.getMode() == Mode.NOT) {
        invertIfRegion(ifRegion);
      }
    }
    IContainer elseRegion = ifRegion.getElseRegion();
    if (elseRegion == null || RegionUtils.isEmpty(elseRegion)) {
      return;
    }
    boolean thenIsEmpty = RegionUtils.isEmpty(ifRegion.getThenRegion());
    if (thenIsEmpty || hasSimpleReturnBlock(ifRegion.getThenRegion())) {
View Full Code Here

   */
  private static void markElseIfChains(IfRegion ifRegion) {
    if (hasSimpleReturnBlock(ifRegion.getThenRegion())) {
      return;
    }
    IContainer elsRegion = ifRegion.getElseRegion();
    if (elsRegion instanceof Region) {
      List<IContainer> subBlocks = ((Region) elsRegion).getSubBlocks();
      if (subBlocks.size() == 1 && subBlocks.get(0) instanceof IfRegion) {
        subBlocks.get(0).add(AFlag.ELSE_IF_CHAIN);
        elsRegion.add(AFlag.ELSE_IF_CHAIN);
      }
    }
  }
View Full Code Here

    return RegionUtils.hasExitBlock(region)
        || RegionUtils.hasBreakInsn(region);
  }

  private static void invertIfRegion(IfRegion ifRegion) {
    IContainer elseRegion = ifRegion.getElseRegion();
    if (elseRegion != null) {
      ifRegion.invert();
    }
  }
View Full Code Here

  }

  public void invert() {
    condition = IfCondition.invert(condition);
    // swap regions
    IContainer tmp = thenRegion;
    thenRegion = elseRegion;
    elseRegion = tmp;
  }
View Full Code Here

TOP

Related Classes of jadx.core.dex.nodes.IContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.