use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.
the class MatchCase method resolve.
public void resolve(MarkerList markers, IType type, IContext context) {
if (this.pattern != null) {
this.pattern = this.pattern.resolve(markers, context);
final Pattern typedPattern = this.pattern.withType(type, markers);
if (typedPattern == null) {
Marker marker = Markers.semanticError(this.pattern.getPosition(), "pattern.type.incompatible");
marker.addInfo(Markers.getSemantic("pattern.type", this.pattern.getType()));
marker.addInfo(Markers.getSemantic("value.type", type));
markers.add(marker);
} else {
this.pattern = typedPattern;
}
}
context = context.push(this);
if (this.condition != null) {
this.condition = this.condition.resolve(markers, context);
this.condition = TypeChecker.convertValue(this.condition, Types.BOOLEAN, null, markers, context, CONDITION_MARKER_SUPPLIER);
}
if (this.action != null) {
this.action = this.action.resolve(markers, context);
}
context.pop();
}
use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.
the class EnumConstant method check.
@Override
public void check(MarkerList markers, IContext context) {
final IClass enclosingClass = this.getEnclosingClass();
final IType classType = enclosingClass.getClassType();
if (!enclosingClass.hasModifier(Modifiers.ENUM_CLASS)) {
final Marker marker = Markers.semanticError(this.position, "field.enum.class", this.name);
marker.addInfo(Markers.getSemantic("method.enclosing_class", classType));
markers.add(marker);
}
super.check(markers, context);
}
use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.
the class AbstractCall method reportResolve.
protected void reportResolve(MarkerList markers, MatchList<IMethod> matches) {
final Marker marker;
if (// isAmbiguous returns false for empty lists
matches == null || !matches.isAmbigous()) {
marker = Markers.semanticError(this.position, "method.access.resolve", this.getName());
} else {
marker = Markers.semanticError(this.position, "method.access.ambiguous", this.getName());
}
this.addArgumentInfo(marker);
this.addCandidates(matches, marker);
markers.add(marker);
}
use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.
the class ConstructorCall method resolveArrayConstructor.
private void resolveArrayConstructor(MarkerList markers, IContext context, ArrayType arrayType) {
final IType elementType = arrayType.getElementType();
if (elementType.hasTag(IType.TYPE_VAR)) {
markers.add(Markers.semanticError(this.position, "constructor.access.array.typevar", elementType));
}
final int len = this.arguments.size();
final int dims = 1 + getDimensions(arrayType.getElementType());
if (len > dims) {
final Marker marker = Markers.semanticError(this.position, "constructor.access.array.length");
marker.addInfo(Markers.getSemantic("type.dimensions", dims));
marker.addInfo(Markers.getSemantic("constructor.access.array.count", len));
markers.add(marker);
return;
}
for (int i = 0; i < len; i++) {
final IValue value = this.arguments.get(i, null);
final IValue typed = TypeChecker.convertValue(value, Types.INT, ITypeContext.DEFAULT, markers, context, TypeChecker.markerSupplier("constructor.access.array.type"));
this.arguments.set(i, null, typed);
}
}
use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.
the class FieldAssignment method reportResolve.
@Override
protected void reportResolve(MarkerList markers) {
final Marker marker = Markers.semanticError(this.position, "resolve.field", this.name.unqualified);
if (this.receiver != null) {
marker.addInfo(Markers.getSemantic("receiver.type", this.receiver.getType()));
}
markers.add(marker);
}
Aggregations