use of dyvilx.tools.compiler.ast.type.generic.ClassGenericType in project Dyvil by Dyvil.
the class AbstractClass method getThisType.
@Override
public IType getThisType() {
if (this.thisType != null) {
return this.thisType;
}
if (this.typeParameters == null) {
return this.thisType = this.classType;
}
final ClassGenericType type = new ClassGenericType(this);
final TypeList arguments = type.getArguments();
for (int i = 0; i < this.typeParameters.size(); i++) {
arguments.add(new TypeVarType(this.typeParameters.get(i)));
}
return this.thisType = type;
}
use of dyvilx.tools.compiler.ast.type.generic.ClassGenericType in project Dyvil by Dyvil.
the class EnumClassMetadata method resolveTypesPre.
@Override
public void resolveTypesPre(MarkerList markers, IContext context) {
super.resolveTypesPre(markers, context);
this.theClass.getAttributes().addFlag(Modifiers.FINAL);
// Ensure the super type is Enum<TYPE>
final IType classType = this.theClass.getClassType();
final IType superType = this.theClass.getSuperType();
if (// default
superType != Types.OBJECT) {
markers.add(Markers.semanticError(superType.getPosition(), "enum.super_class"));
}
this.theClass.setSuperType(new ClassGenericType(Types.ENUM_CLASS, classType));
}
use of dyvilx.tools.compiler.ast.type.generic.ClassGenericType in project Dyvil by Dyvil.
the class ClassOperator method resolveTypes.
// Phases
@Override
public void resolveTypes(MarkerList markers, IContext context) {
if (this.type == null) {
this.type = dyvilx.tools.compiler.ast.type.builtin.Types.UNKNOWN;
markers.add(Markers.semantic(this.position, "classoperator.invalid"));
return;
}
this.type = this.type.resolveType(markers, context);
this.genericType = new ClassGenericType(LazyFields.CLASS_CLASS, this.type);
}
use of dyvilx.tools.compiler.ast.type.generic.ClassGenericType 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;
}
use of dyvilx.tools.compiler.ast.type.generic.ClassGenericType in project Dyvil by Dyvil.
the class TypeOperator method resolveTypes.
@Override
public void resolveTypes(MarkerList markers, IContext context) {
if (this.type == null) {
this.type = dyvilx.tools.compiler.ast.type.builtin.Types.UNKNOWN;
markers.add(Markers.semantic(this.position, "typeoperator.invalid"));
return;
}
this.type = this.type.resolveType(markers, context);
this.genericType = new ClassGenericType(LazyFields.TYPE_CLASS, this.type);
}
Aggregations