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;
}
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;
}
}
}
}
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);
}
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);
}
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);
}
}
Aggregations