Exemplo n.º 1
0
 public GraphTextWriter getMetaData(ABC abc, GraphTextWriter writer) {
   List<Entry<String, Map<String, String>>> md = getMetaDataTable(abc);
   for (Entry<String, Map<String, String>> en : md) {
     String name = en.getKey();
     if (METADATA_DEFINITION.equals(name) || METADATA_CTOR_DEFINITION.equals(name)) {
       continue;
     }
     writer.append("[").append(name);
     if (!en.getValue().isEmpty()) {
       writer.append("(");
       boolean first = true;
       for (String key : en.getValue().keySet()) {
         if (!first) {
           writer.append(",");
         }
         first = false;
         if (!key.isEmpty()) {
           writer.append(IdentifiersDeobfuscation.printIdentifier(true, key)).append("=");
         }
         writer.append("\"");
         String val = en.getValue().get(key);
         writer.append(Helper.escapeString(val));
         writer.append("\"");
       }
       writer.append(")");
     }
     writer.append("]");
     writer.newLine();
   }
   return writer;
 }
Exemplo n.º 2
0
  public GraphTextWriter getModifiers(ABC abc, boolean isStatic, GraphTextWriter writer) {
    if ((kindFlags & ATTR_Override) > 0) {
      writer.appendNoHilight("override ");
    }
    Multiname m = getName(abc);
    if (m != null) {
      String nsname = "";
      for (ABCContainerTag abcTag : abc.getAbcTags()) {
        if (m.namespace_index == -1) {
          break;
        }
        DottedChain dc =
            abcTag
                .getABC()
                .nsValueToName(
                    abc.constants.getNamespace(m.namespace_index).getName(abc.constants));
        nsname = dc.getLast();

        if (nsname == null) {
          break;
        }
        if (!nsname.isEmpty()) {
          break;
        }
      }

      Namespace ns = m.getNamespace(abc.constants);

      if (nsname != null) {
        String identifier = IdentifiersDeobfuscation.printIdentifier(true, nsname);
        if (identifier != null && !identifier.isEmpty()) {
          writer.appendNoHilight(identifier).appendNoHilight(" ");
        }
      }
      if (ns != null) {
        String nsPrefix = ns.getPrefix(abc);
        if (nsPrefix != null && !nsPrefix.isEmpty()) {
          writer.appendNoHilight(nsPrefix).appendNoHilight(" ");
        }
      }
    }
    if (isStatic) {
      if ((this instanceof TraitSlotConst) && ((TraitSlotConst) this).isNamespace()) {
        // static is automatic
      } else {
        writer.appendNoHilight("static ");
      }
    }
    if ((kindFlags & ATTR_Final) > 0) {
      if (!isStatic) {
        writer.appendNoHilight("final ");
      }
    }
    return writer;
  }