Search in sources :

Example 26 with Name

use of dyvil.lang.Name in project Dyvil by Dyvil.

the class ObjectSurrogate method resolve.

@Override
public Pattern resolve(MarkerList markers, IContext context) {
    if (this.type.typeTag() == IType.NAMED) {
        NamedType namedType = (NamedType) this.type;
        final Name name = namedType.getName();
        IType parent = namedType.getParent();
        if (parent != null) {
            parent = parent.resolveType(markers, context);
            namedType.setParent(parent);
            IDataMember dataMember = parent.resolveField(name);
            if (dataMember != null) {
                return new FieldPattern(this.position, dataMember).resolve(markers, context);
            }
        } else {
            IDataMember dataMember = context.resolveField(name);
            if (dataMember != null) {
                return new FieldPattern(this.position, dataMember).resolve(markers, context);
            }
        }
    }
    this.type = this.type.resolveType(markers, context);
    final IClass theClass = this.type.getTheClass();
    if (theClass != null && !theClass.hasModifier(Modifiers.OBJECT_CLASS)) {
        markers.add(Markers.semanticError(this.position, "pattern.object", theClass.getName()));
    }
    return this;
}
Also used : NamedType(dyvilx.tools.compiler.ast.type.raw.NamedType) IClass(dyvilx.tools.compiler.ast.classes.IClass) IDataMember(dyvilx.tools.compiler.ast.field.IDataMember) Name(dyvil.lang.Name) IType(dyvilx.tools.compiler.ast.type.IType)

Example 27 with Name

use of dyvil.lang.Name in project Dyvil by Dyvil.

the class NamedArgumentList method resolveTypes.

@Override
public void resolveTypes(MarkerList markers, IContext context) {
    for (int i = 0; i < this.size; i++) {
        final Name key = this.keys[i];
        final IValue value = this.values[i];
        value.resolveTypes(markers, context);
        if (key == null) {
            continue;
        }
        for (int j = 0; j < i; j++) {
            if (this.keys[j] == key) {
                markers.add(Markers.semanticError(value.getPosition(), "arguments.duplicate.key", key));
                break;
            }
        }
    }
}
Also used : IValue(dyvilx.tools.compiler.ast.expression.IValue) Name(dyvil.lang.Name)

Example 28 with Name

use of dyvil.lang.Name in project Dyvil by Dyvil.

the class NamedArgumentList method appendType.

@Override
protected void appendType(@NonNull StringBuilder buffer, int index) {
    final Name key = this.keys[index];
    if (key != null) {
        buffer.append(key).append(": ");
    }
    this.values[index].getType().toString("", buffer);
}
Also used : Name(dyvil.lang.Name)

Example 29 with Name

use of dyvil.lang.Name in project Dyvil by Dyvil.

the class ParameterList method signatureToString.

private static void signatureToString(StringBuilder buffer, ITypeContext typeContext, IParameter parameter) {
    final Name name = parameter.getName();
    if (name != null) {
        buffer.append(name).append(": ");
    }
    Util.typeToString(parameter.getType(), typeContext, buffer);
}
Also used : Name(dyvil.lang.Name)

Example 30 with Name

use of dyvil.lang.Name in project Dyvil by Dyvil.

the class HeaderDeclaration method check.

public void check(MarkerList markers) {
    Name headerName = this.header.getName();
    if (headerName != this.name) {
        Marker m = Markers.semantic(this.position, "header.name.mismatch");
        m.addInfo(Markers.getSemantic("header.name", headerName));
        m.addInfo(Markers.getSemantic("header.declaration.name", this.name));
        markers.add(m);
    }
}
Also used : Marker(dyvilx.tools.parsing.marker.Marker) Name(dyvil.lang.Name)

Aggregations

Name (dyvil.lang.Name)33 Annotation (dyvilx.tools.compiler.ast.attribute.annotation.Annotation)4 CodeAnnotation (dyvilx.tools.compiler.ast.attribute.annotation.CodeAnnotation)4 AnnotationParser (dyvilx.tools.compiler.parser.annotation.AnnotationParser)4 TypeParser (dyvilx.tools.compiler.parser.type.TypeParser)4 IClass (dyvilx.tools.compiler.ast.classes.IClass)3 IField (dyvilx.tools.compiler.ast.field.IField)3 IParameter (dyvilx.tools.compiler.ast.parameter.IParameter)3 IType (dyvilx.tools.compiler.ast.type.IType)3 AttributeList (dyvilx.tools.compiler.ast.attribute.AttributeList)2 Modifier (dyvilx.tools.compiler.ast.attribute.modifiers.Modifier)2 IValue (dyvilx.tools.compiler.ast.expression.IValue)2 IOperator (dyvilx.tools.compiler.ast.expression.operator.IOperator)2 IDataMember (dyvilx.tools.compiler.ast.field.IDataMember)2 IProperty (dyvilx.tools.compiler.ast.field.IProperty)2 IMethod (dyvilx.tools.compiler.ast.method.IMethod)2 ArgumentList (dyvilx.tools.compiler.ast.parameter.ArgumentList)2 CodeParameter (dyvilx.tools.compiler.ast.parameter.CodeParameter)2 NamedType (dyvilx.tools.compiler.ast.type.raw.NamedType)2 ExpressionParser (dyvilx.tools.compiler.parser.expression.ExpressionParser)2