Search in sources :

Example 6 with ClazzInfo

use of org.robovm.compiler.clazz.ClazzInfo in project robovm by robovm.

the class Linker method buildTypeInfo.

private TypeInfo buildTypeInfo(TypeInfo typeInfo, Map<ClazzInfo, TypeInfo> typeInfos) {
    if (typeInfo.error || typeInfo.classTypes != null) {
        return typeInfo;
    }
    ClazzInfo ci = typeInfo.clazz.getClazzInfo();
    List<TypeInfo> clTypeInfos = new ArrayList<TypeInfo>();
    Set<TypeInfo> ifTypeInfos = new TreeSet<TypeInfo>();
    if (!ci.isInterface()) {
        if (ci.hasSuperclass()) {
            TypeInfo superTypeInfo = buildTypeInfo(typeInfos.get(ci.getSuperclass()), typeInfos);
            if (superTypeInfo.error) {
                typeInfo.error = true;
                return typeInfo;
            }
            clTypeInfos.addAll(Arrays.asList(superTypeInfo.classTypes));
            clTypeInfos.add(typeInfo);
            ifTypeInfos.addAll(Arrays.asList(superTypeInfo.interfaceTypes));
            superTypeInfo.children.add(typeInfo.clazz);
        } else {
            clTypeInfos.add(typeInfo);
        }
    }
    for (ClazzInfo ifCi : ci.getInterfaces()) {
        TypeInfo ifTypeInfo = buildTypeInfo(typeInfos.get(ifCi), typeInfos);
        if (ifTypeInfo.error) {
            typeInfo.error = true;
            return typeInfo;
        }
        ifTypeInfos.addAll(Arrays.asList(ifTypeInfo.interfaceTypes));
    }
    if (ci.isInterface()) {
        ifTypeInfos.add(typeInfo);
    }
    typeInfo.classTypes = EMPTY_TYPE_INFOS;
    typeInfo.interfaceTypes = EMPTY_TYPE_INFOS;
    if (!clTypeInfos.isEmpty()) {
        typeInfo.classTypes = clTypeInfos.toArray(new TypeInfo[clTypeInfos.size()]);
    }
    if (!ifTypeInfos.isEmpty()) {
        typeInfo.interfaceTypes = ifTypeInfos.toArray(new TypeInfo[ifTypeInfos.size()]);
    }
    return typeInfo;
}
Also used : TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) ClazzInfo(org.robovm.compiler.clazz.ClazzInfo)

Aggregations

ClazzInfo (org.robovm.compiler.clazz.ClazzInfo)6 ArrayList (java.util.ArrayList)3 MethodInfo (org.robovm.compiler.clazz.MethodInfo)3 File (java.io.File)2 HashSet (java.util.HashSet)2 TreeSet (java.util.TreeSet)2 Clazz (org.robovm.compiler.clazz.Clazz)2 Dependency (org.robovm.compiler.clazz.Dependency)2 ConstantBitcast (org.robovm.compiler.llvm.ConstantBitcast)2 Function (org.robovm.compiler.llvm.Function)2 FunctionRef (org.robovm.compiler.llvm.FunctionRef)2 Global (org.robovm.compiler.llvm.Global)2 IntegerConstant (org.robovm.compiler.llvm.IntegerConstant)2 NullConstant (org.robovm.compiler.llvm.NullConstant)2 StructureConstantBuilder (org.robovm.compiler.llvm.StructureConstantBuilder)2 CompilerPlugin (org.robovm.compiler.plugin.CompilerPlugin)2 OutputStreamWriter (java.io.OutputStreamWriter)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Random (java.util.Random)1