コード例 #1
0
 private void checkDialog(DlgResource dialog) {
   List<StructEntry> flatList = dialog.getFlatList();
   for (int i = 0; i < flatList.size(); i++) {
     if (flatList.get(i) instanceof StringRef) {
       StringRef ref = (StringRef) flatList.get(i);
       if (ref.getValue() >= 0 && ref.getValue() < strUsed.length) strUsed[ref.getValue()] = true;
     } else if (flatList.get(i) instanceof AbstractCode) {
       AbstractCode code = (AbstractCode) flatList.get(i);
       try {
         String compiled =
             infinity.resource.bcs.Compiler.getInstance()
                 .compileDialogCode(code.toString(), code instanceof Action);
         if (code instanceof Action) Decompiler.decompileDialogAction(compiled, true);
         else Decompiler.decompileDialogTrigger(compiled, true);
         Set<Integer> used = Decompiler.getStringRefsUsed();
         for (final Integer stringRef : used) {
           int u = stringRef.intValue();
           if (u >= 0 && u < strUsed.length) strUsed[u] = true;
         }
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
 }
コード例 #2
0
 private void checkScript(BcsResource script) {
   Decompiler.decompile(script.getCode(), true);
   Set<Integer> used = Decompiler.getStringRefsUsed();
   for (final Integer stringRef : used) {
     int u = stringRef.intValue();
     if (u >= 0 && u < strUsed.length) strUsed[u] = true;
   }
 }
コード例 #3
0
ファイル: DecompilerIfBlock.java プロジェクト: smarr/graal
  public DecompilerIfBlock(
      Block block,
      Decompiler decompiler,
      List<DecompilerBlock> thenBranch,
      List<DecompilerBlock> elseBranch,
      PrintStream infoStream) {
    super(block, decompiler);
    this.thenBranch = thenBranch;
    this.elseBranch = elseBranch;
    this.infoStream = infoStream;
    this.head = new DecompilerBasicBlock(block, decompiler, decompiler.getSchedule());

    if (!(thenBranch.isEmpty() == false
            && head.getBlock().getSuccessors().contains(thenBranch.get(0).getBlock())
        || (elseBranch.isEmpty() == false
            && head.getBlock().getSuccessors().contains(elseBranch.get(0).getBlock())))) {
      // first block of then / else MUST be a successor of the head!
      throw new AssertionError(decompiler.contexInformation);
    }
  }