Search in sources :

Example 1 with TypeVarType

use of dyvilx.tools.compiler.ast.type.typevar.TypeVarType in project Dyvil by Dyvil.

the class ArrayType method getConcreteType.

@Override
public IType getConcreteType(ITypeContext context) {
    IType concrete = this.type.getConcreteType(context);
    final TypeVarType typeVar = this.type.extract(TypeVarType.class);
    if (typeVar != null && concrete.isPrimitive() && !typeVar.getTypeVariable().isAny()) {
        concrete = concrete.getObjectType();
    }
    if (concrete != null && concrete != this.type) {
        return new ArrayType(concrete, this.mutability);
    }
    return this;
}
Also used : TypeVarType(dyvilx.tools.compiler.ast.type.typevar.TypeVarType) IType(dyvilx.tools.compiler.ast.type.IType)

Example 2 with TypeVarType

use of dyvilx.tools.compiler.ast.type.typevar.TypeVarType in project Dyvil by Dyvil.

the class CodeMethod method writeReifyArgument.

private void writeReifyArgument(MethodWriter writer, ITypeParameter thisParameter, Reified.Type reifiedType, ITypeParameter overrideParameter) {
    overrideParameter.writeParameter(writer);
    if (overrideParameter.getReifiedKind() == null) {
        this.writeDefaultReifyArgument(writer, thisParameter, reifiedType);
        return;
    }
    // Delegate to the TypeVarType implementation
    final TypeVarType typeVarType = new TypeVarType(overrideParameter);
    typeVarType.checkType(MarkerList.BLACKHOLE, this, TypePosition.REIFY_FLAG);
    if (reifiedType == Reified.Type.TYPE) {
        typeVarType.writeTypeExpression(writer);
        return;
    }
    typeVarType.writeClassExpression(writer, reifiedType == Reified.Type.OBJECT_CLASS);
}
Also used : TypeVarType(dyvilx.tools.compiler.ast.type.typevar.TypeVarType)

Example 3 with TypeVarType

use of dyvilx.tools.compiler.ast.type.typevar.TypeVarType 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;
}
Also used : TypeVarType(dyvilx.tools.compiler.ast.type.typevar.TypeVarType) ClassGenericType(dyvilx.tools.compiler.ast.type.generic.ClassGenericType) TypeList(dyvilx.tools.compiler.ast.type.TypeList)

Aggregations

TypeVarType (dyvilx.tools.compiler.ast.type.typevar.TypeVarType)3 IType (dyvilx.tools.compiler.ast.type.IType)1 TypeList (dyvilx.tools.compiler.ast.type.TypeList)1 ClassGenericType (dyvilx.tools.compiler.ast.type.generic.ClassGenericType)1