Search in sources :

Example 36 with IClass

use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.

the class IType method isSuperClassOf.

default boolean isSuperClassOf(IType subType) {
    final IClass superClass = this.getTheClass();
    if (superClass == null) {
        return false;
    }
    if (superClass == Types.OBJECT_CLASS) {
        return true;
    }
    final IClass subClass = subType.getTheClass();
    return subClass != null && (subClass == superClass || subClass.isSubClassOf(this));
}
Also used : IClass(dyvilx.tools.compiler.ast.classes.IClass)

Example 37 with IClass

use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.

the class UnionType method getMethodMatches.

@Override
public void getMethodMatches(MatchList<IMethod> list, IValue receiver, Name name, ArgumentList arguments) {
    if (receiver == null || receiver.isIgnoredClassAccess()) {
        // Static Call
        this.left.getMethodMatches(list, receiver, name, arguments);
        this.right.getMethodMatches(list, receiver, name, arguments);
        return;
    }
    this.getTheClass();
    for (IClass commonClass : this.commonClasses) {
        commonClass.getMethodMatches(list, receiver, name, arguments);
    }
}
Also used : IClass(dyvilx.tools.compiler.ast.classes.IClass)

Example 38 with IClass

use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.

the class InternalGenericType method resolveType.

@Override
public IType resolveType(MarkerList markers, IContext context) {
    this.arguments.resolveTypes(markers, context);
    if (this.internalName.startsWith("dyvil/tuple/Tuple$Of")) {
        return new TupleType(this.arguments);
    }
    if (this.internalName.startsWith("dyvil/function/Function$Of")) {
        return new LambdaType(this.arguments);
    }
    switch(this.internalName) {
        case "dyvil/ref/ObjectRef":
            return new ReferenceType(ReferenceType.LazyFields.OBJECT_REF_CLASS, this.arguments.get(0));
        case "dyvil/collection/Map":
            return MapType.base(this.arguments.get(0), this.arguments.get(1));
        case "dyvil/collection/MutableMap":
            return MapType.mutable(this.arguments.get(0), this.arguments.get(1));
        case "dyvil/collection/ImmutableMap":
            return MapType.immutable(this.arguments.get(0), this.arguments.get(1));
    }
    final IClass iclass = Package.rootPackage.resolveInternalClass(this.internalName);
    return new ClassGenericType(iclass, this.arguments);
}
Also used : LambdaType(dyvilx.tools.compiler.ast.type.compound.LambdaType) TupleType(dyvilx.tools.compiler.ast.type.compound.TupleType) IClass(dyvilx.tools.compiler.ast.classes.IClass) ReferenceType(dyvilx.tools.compiler.ast.reference.ReferenceType)

Example 39 with IClass

use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.

the class LambdaType method getLambdaClass.

public static IClass getLambdaClass(int typeCount) {
    IClass iclass = functionClasses[typeCount];
    if (iclass != null) {
        return iclass;
    }
    iclass = Package.dyvilFunction.resolveClass(Names.Function).resolveClass(Name.fromQualified("Of" + typeCount));
    functionClasses[typeCount] = iclass;
    return iclass;
}
Also used : IClass(dyvilx.tools.compiler.ast.classes.IClass)

Example 40 with IClass

use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.

the class TupleType method getTupleClass.

// TypeList Overrides
public static IClass getTupleClass(int count) {
    IClass iclass = tupleClasses[count];
    if (iclass != null) {
        return iclass;
    }
    iclass = Package.dyvilTuple.resolveClass(Names.Tuple).resolveClass(Name.fromQualified("Of" + count));
    tupleClasses[count] = iclass;
    return iclass;
}
Also used : IClass(dyvilx.tools.compiler.ast.classes.IClass)

Aggregations

IClass (dyvilx.tools.compiler.ast.classes.IClass)57 IType (dyvilx.tools.compiler.ast.type.IType)23 Marker (dyvilx.tools.parsing.marker.Marker)9 TypeParameterList (dyvilx.tools.compiler.ast.generic.TypeParameterList)6 ParameterList (dyvilx.tools.compiler.ast.parameter.ParameterList)5 Package (dyvilx.tools.compiler.ast.structure.Package)5 IParameter (dyvilx.tools.compiler.ast.parameter.IParameter)4 Name (dyvil.lang.Name)3 IValue (dyvilx.tools.compiler.ast.expression.IValue)3 ITypeParameter (dyvilx.tools.compiler.ast.generic.ITypeParameter)3 IHeaderUnit (dyvilx.tools.compiler.ast.header.IHeaderUnit)3 ClassBody (dyvilx.tools.compiler.ast.classes.ClassBody)2 IConstructor (dyvilx.tools.compiler.ast.constructor.IConstructor)2 ArgumentList (dyvilx.tools.compiler.ast.parameter.ArgumentList)2 TypeList (dyvilx.tools.compiler.ast.type.TypeList)2 ITypeAlias (dyvilx.tools.compiler.ast.type.alias.ITypeAlias)2 PackageType (dyvilx.tools.compiler.ast.type.raw.PackageType)2 ResolvedTypeVarType (dyvilx.tools.compiler.ast.type.typevar.ResolvedTypeVarType)2 Handle (dyvilx.tools.asm.Handle)1 Annotation (dyvilx.tools.compiler.ast.attribute.annotation.Annotation)1