Search in sources :

Example 1 with ClassType

use of org.eclipse.ceylon.langtools.tools.javac.code.Type.ClassType in project ceylon by eclipse.

the class CeylonEnter method resetClassSymbol.

/**
 * This resets a ClassSymbol recursively, for bootstrap
 */
private void resetClassSymbol(ClassSymbol classSymbol) {
    // look for inner classes
    if (classSymbol.members_field != null) {
        for (Symbol member : classSymbol.getEnclosedElements()) {
            if (member instanceof ClassSymbol) {
                resetClassSymbol((ClassSymbol) member);
            }
        }
    }
    // reset its type, we need to keep it
    org.eclipse.ceylon.langtools.tools.javac.code.Type.ClassType classType = (ClassType) classSymbol.type;
    classType.all_interfaces_field = null;
    classType.interfaces_field = null;
    classType.supertype_field = null;
    classType.typarams_field = null;
    // make sure we give erroneous types a second chance
    if (classType.getTag() == TypeTag.ERROR) {
        // This is how ClassSymbol's constructor builds them, so make'em brand new
        classSymbol.type = new ClassType(org.eclipse.ceylon.langtools.tools.javac.code.Type.noType, null, null);
        classSymbol.type.tsym = classSymbol;
    }
    // reset its members and completer
    classSymbol.members_field = null;
    classSymbol.completer = null;
    // make sure we revert the class symbol kind to a new state by removing ERR kinds
    classSymbol.kind = Kinds.TYP;
    classSymbol.flags_field = 0;
}
Also used : ClassType(org.eclipse.ceylon.langtools.tools.javac.code.Type.ClassType) Type(org.eclipse.ceylon.model.typechecker.model.Type) Symbol(org.eclipse.ceylon.langtools.tools.javac.code.Symbol) ClassSymbol(org.eclipse.ceylon.langtools.tools.javac.code.Symbol.ClassSymbol) ClassSymbol(org.eclipse.ceylon.langtools.tools.javac.code.Symbol.ClassSymbol) ClassType(org.eclipse.ceylon.langtools.tools.javac.code.Type.ClassType) ClassType(org.eclipse.ceylon.langtools.tools.javac.code.Type.ClassType)

Aggregations

Symbol (org.eclipse.ceylon.langtools.tools.javac.code.Symbol)1 ClassSymbol (org.eclipse.ceylon.langtools.tools.javac.code.Symbol.ClassSymbol)1 ClassType (org.eclipse.ceylon.langtools.tools.javac.code.Type.ClassType)1 Type (org.eclipse.ceylon.model.typechecker.model.Type)1