use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class ThisExpr method resolveTypes.
@Override
public void resolveTypes(MarkerList markers, IContext context) {
if (this.type != Types.UNKNOWN) {
this.type = this.type.resolveType(markers, context);
// Replace e.g. this<List> with this<List<T>> in class List<type T>
final IClass iclass = this.type.getTheClass();
if (iclass != null) {
this.type = iclass.getThisType();
}
return;
}
final IType thisType = context.getThisType();
if (thisType != null) {
this.type = thisType;
} else {
markers.add(Markers.semanticError(this.position, "this.access.unresolved"));
}
}
use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class ExternalClass method resolveClass.
@Override
public IClass resolveClass(Name name) {
final IClass bodyClass = this.body.getClass(name);
if (bodyClass != null) {
return bodyClass;
}
if (this.innerTypes == null) {
return null;
}
final String internal = this.innerTypes.get(name.qualified);
if (internal == null) {
return null;
}
// Resolve the class name and add it to the body
final String fileName = internal + DyvilFileType.CLASS_EXTENSION;
return Package.loadClass(fileName, name, this.body);
}
use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class ClassConstructorCall method resolveCall.
@Override
public IValue resolveCall(MarkerList markers, IContext context, boolean report) {
if (!this.type.isResolved()) {
return this;
}
final IClass theClass = this.type.getTheClass();
if (theClass == null) {
return this;
}
final IType type = theClass.isInterface() ? Types.OBJECT : this.type;
final MatchList<IConstructor> candidates = this.resolveCandidates(context, type);
if (candidates.hasCandidate()) {
this.checkArguments(markers, context, candidates.getBestMember());
return this;
}
if (report) {
reportResolve(markers, candidates, this.position, type, this.arguments);
return this;
}
return null;
}
use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class ClassConstructorCall method resolveTypes.
@Override
public void resolveTypes(MarkerList markers, IContext context) {
super.resolveTypes(markers, context);
final IClass theClass = this.type.getTheClass();
if (theClass != null) {
if (theClass.isInterface()) {
this.nestedClass.getInterfaces().add(this.type);
} else {
this.nestedClass.setSuperType(this.type);
}
}
this.nestedClass.resolveTypes(markers, context);
}
use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class ClassConstructorCall method resolve.
@Override
public IValue resolve(MarkerList markers, IContext context) {
this.type.resolve(markers, context);
this.arguments.resolve(markers, context);
this.resolveCall(markers, context, true);
final IClass enclosingClass = context.getThisClass();
assert enclosingClass != null;
this.nestedClass.setConstructor(this.constructor);
this.nestedClass.setEnclosingClass(enclosingClass);
final IHeaderUnit header = enclosingClass.getHeader();
assert header != null;
this.nestedClass.setHeader(header);
header.addCompilable(this.nestedClass);
this.nestedClass.resolve(markers, context);
return this;
}
Aggregations