use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class CaptureVariable method writeSetCopy.
@Override
public void writeSetCopy(@NonNull MethodWriter writer, WriteableExpression receiver, @NonNull WriteableExpression value, int lineNumber) throws BytecodeException {
final IType referenceType = this.variable.getReferenceType();
assert referenceType != null;
referenceType.resolveField(Names.value).writeSetCopy(writer, this.asWriteableExpression(), value, lineNumber);
}
use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class CodeTypeParameter method resolveTypes.
@Override
public void resolveTypes(MarkerList markers, IContext context) {
this.attributes.resolveTypes(markers, context, this);
if (this.lowerBound != null) {
this.lowerBound = this.lowerBound.resolveType(markers, context);
}
this.upperBound = this.upperBound.resolveType(markers, context);
this.upperBounds = getUpperBounds(this.upperBound);
// The first upper bound is meant to be a class bound.
IType type = this.upperBounds[0];
IClass typeClass = type.getTheClass();
if (typeClass != null && !typeClass.isInterface()) {
// If the first type is a class type (not an interface), it becomes the erasure type.
this.erasure = type;
}
// Check if the remaining upper bounds are interfaces
for (int i = 1, count = this.upperBounds.length; i < count; i++) {
type = this.upperBounds[i];
typeClass = type.getTheClass();
if (typeClass != null && !typeClass.isInterface()) {
final Marker marker = Markers.semanticError(type.getPosition(), "type_parameter.bound.class");
marker.addInfo(Markers.getSemantic("class.declaration", Util.classSignatureToString(typeClass)));
markers.add(marker);
}
}
}
use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class CombiningTypeContext method resolveType.
@Override
public IType resolveType(ITypeParameter typeParameter) {
final IType type1 = this.context1.resolveType(typeParameter);
final IType type2 = this.context2.resolveType(typeParameter);
if (type1 == null) {
return type2;
}
if (type2 == null) {
return type1;
}
return Types.combine(type1, type2);
}
use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class GenericData method addMapping.
@Override
public void addMapping(ITypeParameter typeParameter, IType type) {
if (!this.isMethodTypeVariable(typeParameter)) {
return;
}
final int index = typeParameter.getIndex();
final IType current = this.generics.get(index);
if (current == null) {
this.generics.set(index, type);
return;
}
if (index < this.lockedCount) {
return;
}
this.generics.set(index, Types.combine(current, type));
}
use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class PopExpr method writeExpression.
@Override
public void writeExpression(MethodWriter writer, IType type) throws BytecodeException {
final IType valueType = this.value.getType();
this.value.writeExpression(writer, null);
if (!Types.isVoid(valueType)) {
writer.visitInsn(Opcodes.AUTO_POP);
}
}
Aggregations