예제 #1
0
  public String toString() {
    Name name = name();

    if (kind() == null) {
      return "<unknown class " + name + typeParameterString() + ">";
    }

    if (kind() == ANONYMOUS) {
      if (interfaces != null && !interfaces.isEmpty()) {
        return isFunction()
            ? "" + interfaces.get(0)
            : "<anonymous subtype of " + interfaces.get(0) + typeParameters() + ">";
      }
      if (superType != null) {
        return "<anonymous subclass of " + superType + ">" + typeParameterString();
      }
    }

    if (kind() == TOP_LEVEL) {
      Package p = Types.get(package_());
      return (p != null ? p.toString() + "." : "") + name + typeParameterString();
    } else if (kind() == MEMBER) {
      ClassDef outer = Types.get(outer());
      return (outer != null ? outer.toString() + "." : "") + name + typeParameterString();
    } else {
      return name.toString() + typeParameterString();
    }
  }
예제 #2
0
 private static void addToWorkList(ClassDef def, ArrayList<ClassDef> worklist) {
   final Ref<? extends Type> ref = def.superType();
   if (ref != null) {
     addTypeToWorkList(worklist, ref);
   }
   final List<X10FieldDef> props = def.properties();
   for (X10FieldDef p : props) {
     addTypeToWorkList(worklist, p.type());
   }
 }
예제 #3
0
  /** Get the full name of the class, if possible. */
  public QName fullName() {
    Name name = name();

    if (kind() == TOP_LEVEL) {
      Package p = Types.get(package_());
      return QName.make(p != null ? p.fullName() : null, name);
    } else if (kind() == MEMBER) {
      ClassDef outer = Types.get(outer());
      return QName.make(outer != null ? outer.fullName() : null, name);
    } else if (kind() == LOCAL) {
      return QName.make(null, name);
    } else if (kind() == ANONYMOUS) {
      return QName.make(null, Name.make("<anonymous class>"));
    } else {
      return QName.make(null, Name.make("<unknown class>"));
    }
  }