Search in sources :

Example 26 with Marker

use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.

the class TypeChecker method typeError.

public static Marker typeError(SourcePosition position, IType expectedType, IType actualType, String error, String expectedError, String actualError) {
    final Marker marker = Markers.semanticError(position, error);
    marker.addInfo(Markers.getSemantic(expectedError, expectedType));
    marker.addInfo(Markers.getSemantic(actualError, actualType));
    return marker;
}
Also used : Marker(dyvilx.tools.parsing.marker.Marker)

Example 27 with Marker

use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.

the class TypeChecker method typeError.

public static Marker typeError(SourcePosition position, IType expected, IType actual, String key, String expectedError, String actualError, Object... args) {
    final Marker marker = Markers.semanticError(position, key, args);
    marker.addInfo(Markers.getSemantic(expectedError, expected));
    marker.addInfo(Markers.getSemantic(actualError, actual));
    return marker;
}
Also used : Marker(dyvilx.tools.parsing.marker.Marker)

Example 28 with Marker

use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.

the class ConstructorCall method reportResolve.

protected static void reportResolve(MarkerList markers, MatchList<IConstructor> list, SourcePosition position, IType type, ArgumentList arguments) {
    final Marker marker;
    if (list == null || !list.isAmbigous()) {
        marker = Markers.semanticError(position, "constructor.access.resolve", type.toString());
        addArgumentInfo(marker, arguments);
    } else {
        marker = Markers.semanticError(position, "constructor.access.ambiguous", type.toString());
        addArgumentInfo(marker, arguments);
        addCandidates(list, marker);
    }
    markers.add(marker);
}
Also used : Marker(dyvilx.tools.parsing.marker.Marker)

Example 29 with Marker

use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.

the class FieldAccess method reportResolve.

@Override
protected void reportResolve(MarkerList markers) {
    final Marker marker = Markers.semanticError(this.position, "method.access.resolve.field", this.name);
    if (this.receiver != null) {
        marker.addInfo(Markers.getSemantic("receiver.type", this.receiver.getType()));
    }
    markers.add(marker);
}
Also used : Marker(dyvilx.tools.parsing.marker.Marker)

Example 30 with Marker

use of dyvilx.tools.parsing.marker.Marker in project Dyvil by Dyvil.

the class FieldAccess method toReferenceValue.

@Override
public IValue toReferenceValue(MarkerList markers, IContext context) {
    if (this.field == null) {
        // avoid extra error
        return this;
    }
    final IReference ref;
    if (this.field.isLocal()) {
        if (!((IVariable) this.field).setReferenceType()) {
            final Marker marker = Markers.semanticError(this.position, "reference.variable.invalid", Util.memberNamed(this.field));
            markers.add(marker);
            return this;
        }
        ref = new VariableReference(this.field.capture(context));
    } else if (this.field.isStatic()) {
        ref = new StaticFieldReference((IField) this.field);
    } else {
        ref = new InstanceFieldReference(this.receiver, (IField) this.field);
    }
    return new ReferenceOperator(this, ref);
}
Also used : Marker(dyvilx.tools.parsing.marker.Marker)

Aggregations

Marker (dyvilx.tools.parsing.marker.Marker)46 IType (dyvilx.tools.compiler.ast.type.IType)23 IClass (dyvilx.tools.compiler.ast.classes.IClass)11 IValue (dyvilx.tools.compiler.ast.expression.IValue)7 ITypeParameter (dyvilx.tools.compiler.ast.generic.ITypeParameter)4 TypeParameterList (dyvilx.tools.compiler.ast.generic.TypeParameterList)4 NonNull (dyvil.annotation.internal.NonNull)3 Name (dyvil.lang.Name)3 MarkerLevel (dyvil.util.MarkerLevel)3 ArgumentList (dyvilx.tools.compiler.ast.parameter.ArgumentList)3 Pattern (dyvilx.tools.compiler.ast.pattern.Pattern)3 TypeList (dyvilx.tools.compiler.ast.type.TypeList)3 SourcePosition (dyvil.source.position.SourcePosition)2 IContext (dyvilx.tools.compiler.ast.context.IContext)2 ITypeContext (dyvilx.tools.compiler.ast.generic.ITypeContext)2 AbstractPattern (dyvilx.tools.compiler.ast.pattern.AbstractPattern)2 Types (dyvilx.tools.compiler.ast.type.builtin.Types)2 ArrayType (dyvilx.tools.compiler.ast.type.compound.ArrayType)2 Markers (dyvilx.tools.compiler.util.Markers)2 MarkerList (dyvilx.tools.parsing.marker.MarkerList)2