use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class FieldAccess method resolveAsType.
@Override
protected IValue resolveAsType(IContext context) {
final IType parentType;
if (this.receiver == null) {
parentType = null;
} else if (this.receiver.isClassAccess()) {
parentType = this.receiver.getType();
} else {
return null;
}
final IType type = new NamedType(this.position, this.name, parentType).resolveType(null, context);
return type != null ? new ClassAccess(this.position, type) : null;
}
use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class CaptureField method writeGet.
@Override
public void writeGet(@NonNull MethodWriter writer, WriteableExpression receiver, int lineNumber) throws BytecodeException {
final IType referenceType = this.variable.getReferenceType();
if (referenceType != null) {
referenceType.resolveField(Names.value).writeGet(writer, this.asWriteableExpression(receiver), lineNumber);
return;
}
this.writeGetRaw(writer, receiver, lineNumber);
}
use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class CaptureField method writeSet.
@Override
public void writeSet(@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).writeSet(writer, this.asWriteableExpression(receiver), value, lineNumber);
}
use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class CaptureParameter method getDefaultValue.
@Override
public IValue getDefaultValue(IContext context) {
final IValue access = new FieldAccess(this.variable) {
@Override
public void writeExpression(MethodWriter writer, IType type) throws BytecodeException {
this.field.writeGetRaw(writer, this.receiver, this.lineNumber());
}
}.resolve(MarkerList.BLACKHOLE, context);
// ensures proper capture
access.checkTypes(MarkerList.BLACKHOLE, context);
return access;
}
use of dyvilx.tools.compiler.ast.type.IType in project Dyvil by Dyvil.
the class CaptureVariable method writeSet.
@Override
public void writeSet(@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).writeSet(writer, this.asWriteableExpression(), value, lineNumber);
}
Aggregations