use of dyvilx.tools.compiler.ast.context.CombiningContext in project Dyvil by Dyvil.
the class Property method resolve.
@Override
public void resolve(MarkerList markers, IContext context) {
super.resolve(markers, context);
if (this.getter != null) {
this.getter.resolve(markers, context);
// Infer Type if necessary
if (this.type == Types.UNKNOWN) {
this.type = this.getter.getType();
if (this.setterParameter != null) {
this.setterParameter.setType(this.type);
}
}
}
if (this.type == Types.UNKNOWN) {
markers.add(Markers.semanticError(this.position, "property.type.infer", this.name));
}
if (this.setter != null) {
this.setter.resolve(markers, context);
}
if (this.initializer != null) {
final IContext context1 = new CombiningContext(this, context);
final IValue resolved = this.initializer.resolve(markers, context1);
this.initializer = TypeChecker.convertValue(resolved, Types.VOID, Types.VOID, markers, context1, TypeChecker.markerSupplier("property.initializer.type"));
}
}
use of dyvilx.tools.compiler.ast.context.CombiningContext in project Dyvil by Dyvil.
the class SingleImport method resolveTypes.
@Override
public void resolveTypes(MarkerList markers, IContext context, IImportContext parentContext, int mask) {
if (this.parent != null) {
this.parent.resolveTypes(markers, context, parentContext, KindedImport.PARENT);
parentContext = this.parent.asParentContext();
}
boolean resolved = false;
this.resolver = parentContext;
this.mask = mask;
if ((mask & KindedImport.CLASS) != 0) {
final IClass theClass = parentContext.resolveClass(this.name);
if (theClass != null) {
this.asParentContext = theClass;
resolved = true;
}
}
if ((mask & KindedImport.HEADER) != 0) {
final IHeaderUnit header = parentContext.resolveHeader(this.name);
if (header != null) {
if ((mask & KindedImport.INLINE) != 0 && this.checkInline(markers, context, header)) {
this.asContext = new CombiningContext(this, header.getContext());
}
this.asParentContext = !resolved ? header : new CombiningContext(header, this.asParentContext);
resolved = true;
}
}
if ((mask & KindedImport.PACKAGE) != 0) {
final Package thePackage = parentContext.resolvePackage(this.name);
if (thePackage != null) {
this.asParentContext = !resolved ? thePackage : new CombiningContext(thePackage, this.asParentContext);
resolved = true;
}
}
if (!resolved) {
this.asParentContext = IDefaultContext.DEFAULT;
if (mask == KindedImport.PARENT) {
// when resolving as a parent import, the resolve method is never called,
// so we need the error reporting to happen here.
this.reportResolve(markers);
}
}
// otherwise error later
}
Aggregations