Search in sources :

Example 1 with ClassType

use of dyvilx.tools.compiler.ast.type.raw.ClassType in project Dyvil by Dyvil.

the class IType method readType.

static IType readType(DataInput dis) throws IOException {
    int tag = dis.readUnsignedByte();
    IType type;
    switch(tag) {
        case UNKNOWN:
            return Types.UNKNOWN;
        case NULL:
            return Types.NULL;
        case NONE:
            return Types.NONE;
        case ANY:
            return Types.ANY;
        case PRIMITIVE:
            return PrimitiveType.fromTypecode(dis.readByte());
        case CLASS:
            type = new ClassType();
            break;
        case PACKAGE:
            type = new PackageType();
            break;
        case GENERIC:
            type = new ClassGenericType();
            break;
        case TUPLE:
            type = new TupleType();
            break;
        case LAMBDA:
            type = new LambdaType();
            break;
        case ARRAY:
            type = new ArrayType();
            break;
        case MAP:
            type = new MapType();
            break;
        case OPTIONAL:
            type = new NullableType();
            break;
        case IMPLICIT_OPTIONAL:
            type = new ImplicitNullableType();
            break;
        case REFERENCE:
            type = new ReferenceType();
            break;
        case ANNOTATED:
            type = new AnnotatedType();
            break;
        case TYPE_VAR:
            type = new NamedType();
            break;
        case WILDCARD_TYPE:
            type = new WildcardType();
            break;
        case MISSING_TAG:
            return null;
        default:
            throw new Error("Cannot decode TypeTag " + tag);
    }
    type.read(dis);
    return type;
}
Also used : NamedType(dyvilx.tools.compiler.ast.type.raw.NamedType) ClassType(dyvilx.tools.compiler.ast.type.raw.ClassType) ReferenceType(dyvilx.tools.compiler.ast.reference.ReferenceType) PackageType(dyvilx.tools.compiler.ast.type.raw.PackageType) ClassGenericType(dyvilx.tools.compiler.ast.type.generic.ClassGenericType)

Aggregations

ReferenceType (dyvilx.tools.compiler.ast.reference.ReferenceType)1 ClassGenericType (dyvilx.tools.compiler.ast.type.generic.ClassGenericType)1 ClassType (dyvilx.tools.compiler.ast.type.raw.ClassType)1 NamedType (dyvilx.tools.compiler.ast.type.raw.NamedType)1 PackageType (dyvilx.tools.compiler.ast.type.raw.PackageType)1