Search in sources :

Example 1 with BytecodeException

use of dyvilx.tools.compiler.backend.exception.BytecodeException 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;
}
Also used : IValue(dyvilx.tools.compiler.ast.expression.IValue) BytecodeException(dyvilx.tools.compiler.backend.exception.BytecodeException) MethodWriter(dyvilx.tools.compiler.backend.MethodWriter) FieldAccess(dyvilx.tools.compiler.ast.expression.access.FieldAccess) IType(dyvilx.tools.compiler.ast.type.IType)

Example 2 with BytecodeException

use of dyvilx.tools.compiler.backend.exception.BytecodeException in project Dyvil by Dyvil.

the class ValueAnnotationVisitor method visit.

@Override
public void visit(String key, Object value) {
    final IValue iValue = IValue.fromObject(value);
    if (iValue == null) {
        throw new BytecodeException("Cannot convert '" + value + "' into an IValue");
    }
    this.consumer.setValue(iValue);
}
Also used : IValue(dyvilx.tools.compiler.ast.expression.IValue) BytecodeException(dyvilx.tools.compiler.backend.exception.BytecodeException)

Aggregations

IValue (dyvilx.tools.compiler.ast.expression.IValue)2 BytecodeException (dyvilx.tools.compiler.backend.exception.BytecodeException)2 FieldAccess (dyvilx.tools.compiler.ast.expression.access.FieldAccess)1 IType (dyvilx.tools.compiler.ast.type.IType)1 MethodWriter (dyvilx.tools.compiler.backend.MethodWriter)1