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));
}
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);
}
}
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);
}
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;
}
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;
}
Aggregations