throw runtime.newTypeError(value, runtime.fastGetModule("FFI").fastGetClass("Struct"));
}
} else if (type instanceof MappedType) {
MappedType mappedType = (MappedType) type;
setReturnValue(runtime, mappedType.getRealType(), buffer, mappedType.toNative(runtime.getCurrentContext(), value));
} else {
buffer.setLongReturn(0L);
throw runtime.newRuntimeError("unsupported return type from struct: " + type);
}