newObjRefBuilder method

ObjRefBuilder newObjRefBuilder(
  1. String? position,
  2. RefDetails reference
)

create object reference position: top-left/top-middle/top-right/center-left/center-middle/center-right/bottom-left/bottom-middle/bottom-right

Implementation

ObjRefBuilder newObjRefBuilder(
  String? position,
  RefDetails reference,
) {
  final tmp0 = position;
  final tmp6 = reference;
  var tmp1 = 0;
  var tmp3 = 0;
  var tmp4 = 0;
  var tmp5 = 0;
  var tmp7 = 0;
  if (tmp0 == null) {
    tmp1 = 0;
  } else {
    tmp1 = 1;
    final tmp2 = tmp0;
    final tmp2_0 = utf8.encode(tmp2);
    tmp4 = tmp2_0.length;

    final ffi.Pointer<ffi.Uint8> tmp3_0 = this.__allocate(tmp4 * 1, 1);
    final Uint8List tmp3_1 = tmp3_0.asTypedList(tmp4);
    tmp3_1.setAll(0, tmp2_0);
    tmp3 = tmp3_0.address;
    tmp5 = tmp4;
  }
  tmp7 = tmp6._box.move();
  final tmp8 = _newObjRefBuilder(
    tmp1,
    tmp3,
    tmp4,
    tmp5,
    tmp7,
  );
  final tmp10 = tmp8.arg0;
  final tmp11 = tmp8.arg1;
  final tmp12 = tmp8.arg2;
  final tmp13 = tmp8.arg3;
  final tmp14 = tmp8.arg4;
  if (tmp10 == 0) {
    debugAllocation("handle error", tmp11, tmp12);
    final ffi.Pointer<ffi.Uint8> tmp11_0 = ffi.Pointer.fromAddress(tmp11);
    final tmp10_0 =
        utf8.decode(tmp11_0.asTypedList(tmp12), allowMalformed: true);
    if (tmp12 > 0) {
      final ffi.Pointer<ffi.Void> tmp11_0;
      tmp11_0 = ffi.Pointer.fromAddress(tmp11);
      this.__deallocate(tmp11_0, tmp13, 1);
    }
    throw tmp10_0;
  }
  final ffi.Pointer<ffi.Void> tmp14_0 = ffi.Pointer.fromAddress(tmp14);
  final tmp14_1 = _Box(this, tmp14_0, "drop_box_ObjRefBuilder");
  tmp14_1._finalizer = this._registerFinalizer(tmp14_1);
  final tmp9 = ObjRefBuilder._(this, tmp14_1);
  return tmp9;
}