evalWithBinary method
Implementation
dynamic evalWithBinary(Pointer<Void> ctxHandle, Uint8List bytecode) {
final ptr = ffi.malloc<Uint8>(bytecode.length);
ptr.asTypedList(bytecode.length).setAll(0, bytecode);
final out = ffi.calloc<QjsResult>();
_evaluateValueOut(ctxHandle, ptr.cast(), bytecode.length, 1, out);
ffi.malloc.free(ptr);
if (out.ref.error != 0) {
final msg = out.ref.s.address == 0
? 'Unknown error'
: out.ref.s.toDartString();
_freeResult(out);
ffi.calloc.free(out);
throw Exception(msg);
}
final res = convertQjsResultToDart(out.ref);
if (out.ref.type == qjsTypeObject || out.ref.type == qjsTypeFunction) {
_freeValue(ctxHandle, out);
}
_freeResult(out);
ffi.calloc.free(out);
return res;
}