From 9e49390568ea832dc093fc4f76d6f3b74caa14ba Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Wed, 23 Oct 2024 13:38:55 +1100 Subject: [PATCH] Use package:dart_style --- pkgs/ffigen/CHANGELOG.md | 2 + .../objective_c/avf_audio_bindings.dart | 82 +++++++++---------- .../objective_c/avf_audio_bindings.dart.m | 26 +++--- .../example/swift/swift_api_bindings.dart | 82 ++++++++++--------- .../example/swift/swift_api_bindings.dart.m | 24 +++--- .../lib/src/code_generator/library.dart | 18 ++-- pkgs/ffigen/pubspec.yaml | 1 + 7 files changed, 120 insertions(+), 115 deletions(-) diff --git a/pkgs/ffigen/CHANGELOG.md b/pkgs/ffigen/CHANGELOG.md index 46c97e3b8..04a651f4c 100644 --- a/pkgs/ffigen/CHANGELOG.md +++ b/pkgs/ffigen/CHANGELOG.md @@ -1,6 +1,8 @@ ## 15.1.0-wip - Ensure all protocols referenced in bindings are available at runtime. +- Use `package:dart_style` directly to format generated Dart code, rather than + subprocessing to `dart format`. ## 15.0.0 diff --git a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart index 2d1445a21..268d74b76 100644 --- a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart +++ b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart @@ -15,91 +15,91 @@ import 'package:ffi/ffi.dart' as pkg_ffi; @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_ksby9f( +external ffi.Pointer _AVFAudio_wrapListenerBlock_ksby9f( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1k41wmu( +external ffi.Pointer _AVFAudio_wrapListenerBlock_1k41wmu( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_sjfpmz( +external ffi.Pointer _AVFAudio_wrapListenerBlock_sjfpmz( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1j7ar3u( +external ffi.Pointer _AVFAudio_wrapListenerBlock_1j7ar3u( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_rvgf02( +external ffi.Pointer _AVFAudio_wrapListenerBlock_rvgf02( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_ukcdfq( +external ffi.Pointer _AVFAudio_wrapListenerBlock_ukcdfq( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1tjlcwl( +external ffi.Pointer _AVFAudio_wrapListenerBlock_1tjlcwl( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_hepzs( +external ffi.Pointer _AVFAudio_wrapListenerBlock_hepzs( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_117qins( +external ffi.Pointer _AVFAudio_wrapListenerBlock_117qins( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_9w6y6n( +external ffi.Pointer _AVFAudio_wrapListenerBlock_9w6y6n( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_tenbla( +external ffi.Pointer _AVFAudio_wrapListenerBlock_tenbla( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_hfhq9m( +external ffi.Pointer _AVFAudio_wrapListenerBlock_hfhq9m( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1ej8563( +external ffi.Pointer _AVFAudio_wrapListenerBlock_1ej8563( ffi.Pointer block, ); @@ -258,7 +258,7 @@ abstract final class ObjCBlock_ffiVoid { static objc.ObjCBlock listener(void Function() fn) { final raw = objc.newClosureBlock( _ObjCBlock_ffiVoid_listenerCallable.nativeFunction.cast(), () => fn()); - final wrapper = _wrapListenerBlock_ksby9f(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ksby9f(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -525,7 +525,7 @@ abstract final class ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool { ffi.Pointer arg2) => fn(objc.ObjCObjectBase(arg0, retain: false, release: true), objc.ObjCObjectBase(arg1, retain: false, release: true), arg2)); - final wrapper = _wrapListenerBlock_1k41wmu(raw); + final wrapper = _AVFAudio_wrapListenerBlock_1k41wmu(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function( @@ -1637,7 +1637,7 @@ abstract final class ObjCBlock_ffiVoid_ffiVoid_NSCoder { (ffi.Pointer arg0, ffi.Pointer arg1) => fn( arg0, objc.NSCoder.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_sjfpmz(raw); + final wrapper = _AVFAudio_wrapListenerBlock_sjfpmz(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(ffi.Pointer, objc.NSCoder)>(wrapper, @@ -2096,7 +2096,7 @@ abstract final class ObjCBlock_ffiVoid_NSDictionary_NSRange_bool { retain: false, release: true), arg1, arg2)); - final wrapper = _wrapListenerBlock_1j7ar3u(raw); + final wrapper = _AVFAudio_wrapListenerBlock_1j7ar3u(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSDictionary, objc.NSRange, @@ -2282,7 +2282,7 @@ abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool { : objc.ObjCObjectBase(arg0, retain: false, release: true), arg1, arg2)); - final wrapper = _wrapListenerBlock_1j7ar3u(raw); + final wrapper = _AVFAudio_wrapListenerBlock_1j7ar3u(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(ffi.Pointer?, objc.NSRange, @@ -6594,7 +6594,7 @@ abstract final class ObjCBlock_ffiVoid_NSDate_bool_bool { retain: false, release: true), arg1, arg2)); - final wrapper = _wrapListenerBlock_rvgf02(raw); + final wrapper = _AVFAudio_wrapListenerBlock_rvgf02(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSDate?, ffi.Bool, @@ -12148,7 +12148,7 @@ abstract final class ObjCBlock_ffiVoid_NSFileHandle { _ObjCBlock_ffiVoid_NSFileHandle_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn( NSFileHandle.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -12834,7 +12834,7 @@ abstract final class ObjCBlock_ffiVoid_NSError { ? null : objc.NSError.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -13610,7 +13610,7 @@ abstract final class ObjCBlock_ffiVoid_NSDictionary_NSError { ? null : objc.NSError.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); + final wrapper = _AVFAudio_wrapListenerBlock_1tjlcwl(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock( wrapper, @@ -15803,7 +15803,7 @@ abstract final class ObjCBlock_ffiVoid_ffiVoid { final raw = objc.newClosureBlock( _ObjCBlock_ffiVoid_ffiVoid_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn(arg0)); - final wrapper = _wrapListenerBlock_hepzs(raw); + final wrapper = _AVFAudio_wrapListenerBlock_hepzs(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock)>(wrapper, retain: false, release: true); @@ -17386,7 +17386,7 @@ abstract final class ObjCBlock_ffiVoid_NSArray { ? null : objc.NSArray.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -22372,7 +22372,7 @@ abstract final class ObjCBlock_ffiVoid_bool { final raw = objc.newClosureBlock( _ObjCBlock_ffiVoid_bool_listenerCallable.nativeFunction.cast(), (bool arg0) => fn(arg0)); - final wrapper = _wrapListenerBlock_117qins(raw); + final wrapper = _AVFAudio_wrapListenerBlock_117qins(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -23101,7 +23101,7 @@ abstract final class ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool retain: false, release: true), NSMatchingFlags.fromValue(arg1), arg2)); - final wrapper = _wrapListenerBlock_9w6y6n(raw); + final wrapper = _AVFAudio_wrapListenerBlock_9w6y6n(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, @@ -24425,7 +24425,7 @@ abstract final class ObjCBlock_ffiVoid_NSTimer { _ObjCBlock_ffiVoid_NSTimer_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn(NSTimer.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -25364,7 +25364,7 @@ abstract final class ObjCBlock_ffiVoid_NSCachedURLResponse { ? null : NSCachedURLResponse.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -25840,7 +25840,7 @@ abstract final class ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError { ? null : objc.NSError.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); + final wrapper = _AVFAudio_wrapListenerBlock_tenbla(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(NSURLResponse?, objc.NSData?, @@ -25999,7 +25999,7 @@ abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSError { : objc.ObjCObjectBase(arg0, retain: false, release: true), objc.NSError.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); + final wrapper = _AVFAudio_wrapListenerBlock_1tjlcwl(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(ffi.Pointer?, @@ -27090,7 +27090,7 @@ abstract final class ObjCBlock_ffiVoid_NSDictionary { ? null : objc.NSDictionary.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -27238,7 +27238,7 @@ abstract final class ObjCBlock_ffiVoid_NSURLCredential { ? null : NSURLCredential.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -30191,7 +30191,7 @@ abstract final class ObjCBlock_ffiVoid_NSArray_NSArray_NSArray { retain: false, release: true), objc.NSArray.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); + final wrapper = _AVFAudio_wrapListenerBlock_tenbla(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSArray, objc.NSArray, @@ -30320,7 +30320,7 @@ abstract final class ObjCBlock_ffiVoid_NSArray1 { _ObjCBlock_ffiVoid_NSArray1_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn( objc.NSArray.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -30447,7 +30447,7 @@ abstract final class ObjCBlock_ffiVoid_NSData { (ffi.Pointer arg0) => fn(arg0.address == 0 ? null : objc.NSData.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -30923,7 +30923,7 @@ abstract final class ObjCBlock_ffiVoid_NSData_bool_NSError { ? null : objc.NSError.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_hfhq9m(raw); + final wrapper = _AVFAudio_wrapListenerBlock_hfhq9m(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSData, ffi.Bool, objc.NSError?)>(wrapper, @@ -31946,7 +31946,7 @@ abstract final class ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError { ? null : objc.NSError.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); + final wrapper = _AVFAudio_wrapListenerBlock_1tjlcwl(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(NSURLSessionWebSocketMessage?, @@ -32407,7 +32407,7 @@ abstract final class ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError { ? null : objc.NSError.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); + final wrapper = _AVFAudio_wrapListenerBlock_tenbla(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSData?, NSURLResponse?, @@ -32619,7 +32619,7 @@ abstract final class ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError { ? null : objc.NSError.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); + final wrapper = _AVFAudio_wrapListenerBlock_tenbla(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSURL?, NSURLResponse?, @@ -33376,7 +33376,7 @@ abstract final class ObjCBlock_ffiVoid_NSTask { _ObjCBlock_ffiVoid_NSTask_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn(NSTask.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _AVFAudio_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -39841,7 +39841,7 @@ abstract final class ObjCBlock_ffiVoid_bool_NSError { ? null : objc.NSError.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_1ej8563(raw); + final wrapper = _AVFAudio_wrapListenerBlock_1ej8563(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); diff --git a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m index 02b011c09..cacb5a527 100644 --- a/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m +++ b/pkgs/ffigen/example/objective_c/avf_audio_bindings.dart.m @@ -9,7 +9,7 @@ id objc_retainBlock(id); typedef void (^_ListenerTrampoline)(); -_ListenerTrampoline _wrapListenerBlock_ksby9f(_ListenerTrampoline block) NS_RETURNS_RETAINED { +_ListenerTrampoline _AVFAudio_wrapListenerBlock_ksby9f(_ListenerTrampoline block) NS_RETURNS_RETAINED { return ^void() { objc_retainBlock(block); block(); @@ -17,7 +17,7 @@ _ListenerTrampoline _wrapListenerBlock_ksby9f(_ListenerTrampoline block) NS_RETU } typedef void (^_ListenerTrampoline1)(id arg0, id arg1, BOOL * arg2); -_ListenerTrampoline1 _wrapListenerBlock_1k41wmu(_ListenerTrampoline1 block) NS_RETURNS_RETAINED { +_ListenerTrampoline1 _AVFAudio_wrapListenerBlock_1k41wmu(_ListenerTrampoline1 block) NS_RETURNS_RETAINED { return ^void(id arg0, id arg1, BOOL * arg2) { objc_retainBlock(block); block(objc_retain(arg0), objc_retain(arg1), arg2); @@ -25,7 +25,7 @@ _ListenerTrampoline1 _wrapListenerBlock_1k41wmu(_ListenerTrampoline1 block) NS_R } typedef void (^_ListenerTrampoline2)(void * arg0, id arg1); -_ListenerTrampoline2 _wrapListenerBlock_sjfpmz(_ListenerTrampoline2 block) NS_RETURNS_RETAINED { +_ListenerTrampoline2 _AVFAudio_wrapListenerBlock_sjfpmz(_ListenerTrampoline2 block) NS_RETURNS_RETAINED { return ^void(void * arg0, id arg1) { objc_retainBlock(block); block(arg0, objc_retain(arg1)); @@ -33,7 +33,7 @@ _ListenerTrampoline2 _wrapListenerBlock_sjfpmz(_ListenerTrampoline2 block) NS_RE } typedef void (^_ListenerTrampoline3)(id arg0, struct _NSRange arg1, BOOL * arg2); -_ListenerTrampoline3 _wrapListenerBlock_1j7ar3u(_ListenerTrampoline3 block) NS_RETURNS_RETAINED { +_ListenerTrampoline3 _AVFAudio_wrapListenerBlock_1j7ar3u(_ListenerTrampoline3 block) NS_RETURNS_RETAINED { return ^void(id arg0, struct _NSRange arg1, BOOL * arg2) { objc_retainBlock(block); block(objc_retain(arg0), arg1, arg2); @@ -41,7 +41,7 @@ _ListenerTrampoline3 _wrapListenerBlock_1j7ar3u(_ListenerTrampoline3 block) NS_R } typedef void (^_ListenerTrampoline4)(id arg0, BOOL arg1, BOOL * arg2); -_ListenerTrampoline4 _wrapListenerBlock_rvgf02(_ListenerTrampoline4 block) NS_RETURNS_RETAINED { +_ListenerTrampoline4 _AVFAudio_wrapListenerBlock_rvgf02(_ListenerTrampoline4 block) NS_RETURNS_RETAINED { return ^void(id arg0, BOOL arg1, BOOL * arg2) { objc_retainBlock(block); block(objc_retain(arg0), arg1, arg2); @@ -49,7 +49,7 @@ _ListenerTrampoline4 _wrapListenerBlock_rvgf02(_ListenerTrampoline4 block) NS_RE } typedef void (^_ListenerTrampoline5)(id arg0); -_ListenerTrampoline5 _wrapListenerBlock_ukcdfq(_ListenerTrampoline5 block) NS_RETURNS_RETAINED { +_ListenerTrampoline5 _AVFAudio_wrapListenerBlock_ukcdfq(_ListenerTrampoline5 block) NS_RETURNS_RETAINED { return ^void(id arg0) { objc_retainBlock(block); block(objc_retain(arg0)); @@ -57,7 +57,7 @@ _ListenerTrampoline5 _wrapListenerBlock_ukcdfq(_ListenerTrampoline5 block) NS_RE } typedef void (^_ListenerTrampoline6)(id arg0, id arg1); -_ListenerTrampoline6 _wrapListenerBlock_1tjlcwl(_ListenerTrampoline6 block) NS_RETURNS_RETAINED { +_ListenerTrampoline6 _AVFAudio_wrapListenerBlock_1tjlcwl(_ListenerTrampoline6 block) NS_RETURNS_RETAINED { return ^void(id arg0, id arg1) { objc_retainBlock(block); block(objc_retain(arg0), objc_retain(arg1)); @@ -65,7 +65,7 @@ _ListenerTrampoline6 _wrapListenerBlock_1tjlcwl(_ListenerTrampoline6 block) NS_R } typedef void (^_ListenerTrampoline7)(void * arg0); -_ListenerTrampoline7 _wrapListenerBlock_hepzs(_ListenerTrampoline7 block) NS_RETURNS_RETAINED { +_ListenerTrampoline7 _AVFAudio_wrapListenerBlock_hepzs(_ListenerTrampoline7 block) NS_RETURNS_RETAINED { return ^void(void * arg0) { objc_retainBlock(block); block(arg0); @@ -73,7 +73,7 @@ _ListenerTrampoline7 _wrapListenerBlock_hepzs(_ListenerTrampoline7 block) NS_RET } typedef void (^_ListenerTrampoline8)(BOOL arg0); -_ListenerTrampoline8 _wrapListenerBlock_117qins(_ListenerTrampoline8 block) NS_RETURNS_RETAINED { +_ListenerTrampoline8 _AVFAudio_wrapListenerBlock_117qins(_ListenerTrampoline8 block) NS_RETURNS_RETAINED { return ^void(BOOL arg0) { objc_retainBlock(block); block(arg0); @@ -81,7 +81,7 @@ _ListenerTrampoline8 _wrapListenerBlock_117qins(_ListenerTrampoline8 block) NS_R } typedef void (^_ListenerTrampoline9)(id arg0, NSMatchingFlags arg1, BOOL * arg2); -_ListenerTrampoline9 _wrapListenerBlock_9w6y6n(_ListenerTrampoline9 block) NS_RETURNS_RETAINED { +_ListenerTrampoline9 _AVFAudio_wrapListenerBlock_9w6y6n(_ListenerTrampoline9 block) NS_RETURNS_RETAINED { return ^void(id arg0, NSMatchingFlags arg1, BOOL * arg2) { objc_retainBlock(block); block(objc_retain(arg0), arg1, arg2); @@ -89,7 +89,7 @@ _ListenerTrampoline9 _wrapListenerBlock_9w6y6n(_ListenerTrampoline9 block) NS_RE } typedef void (^_ListenerTrampoline10)(id arg0, id arg1, id arg2); -_ListenerTrampoline10 _wrapListenerBlock_tenbla(_ListenerTrampoline10 block) NS_RETURNS_RETAINED { +_ListenerTrampoline10 _AVFAudio_wrapListenerBlock_tenbla(_ListenerTrampoline10 block) NS_RETURNS_RETAINED { return ^void(id arg0, id arg1, id arg2) { objc_retainBlock(block); block(objc_retain(arg0), objc_retain(arg1), objc_retain(arg2)); @@ -97,7 +97,7 @@ _ListenerTrampoline10 _wrapListenerBlock_tenbla(_ListenerTrampoline10 block) NS_ } typedef void (^_ListenerTrampoline11)(id arg0, BOOL arg1, id arg2); -_ListenerTrampoline11 _wrapListenerBlock_hfhq9m(_ListenerTrampoline11 block) NS_RETURNS_RETAINED { +_ListenerTrampoline11 _AVFAudio_wrapListenerBlock_hfhq9m(_ListenerTrampoline11 block) NS_RETURNS_RETAINED { return ^void(id arg0, BOOL arg1, id arg2) { objc_retainBlock(block); block(objc_retain(arg0), arg1, objc_retain(arg2)); @@ -105,7 +105,7 @@ _ListenerTrampoline11 _wrapListenerBlock_hfhq9m(_ListenerTrampoline11 block) NS_ } typedef void (^_ListenerTrampoline12)(BOOL arg0, id arg1); -_ListenerTrampoline12 _wrapListenerBlock_1ej8563(_ListenerTrampoline12 block) NS_RETURNS_RETAINED { +_ListenerTrampoline12 _AVFAudio_wrapListenerBlock_1ej8563(_ListenerTrampoline12 block) NS_RETURNS_RETAINED { return ^void(BOOL arg0, id arg1) { objc_retainBlock(block); block(arg0, objc_retain(arg1)); diff --git a/pkgs/ffigen/example/swift/swift_api_bindings.dart b/pkgs/ffigen/example/swift/swift_api_bindings.dart index aca53c506..f5c86ec0c 100644 --- a/pkgs/ffigen/example/swift/swift_api_bindings.dart +++ b/pkgs/ffigen/example/swift/swift_api_bindings.dart @@ -19,84 +19,88 @@ import 'package:ffi/ffi.dart' as pkg_ffi; @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_ksby9f( +external ffi.Pointer _SwiftLibrary_wrapListenerBlock_ksby9f( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1k41wmu( +external ffi.Pointer + _SwiftLibrary_wrapListenerBlock_1k41wmu( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_sjfpmz( +external ffi.Pointer _SwiftLibrary_wrapListenerBlock_sjfpmz( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1j7ar3u( +external ffi.Pointer + _SwiftLibrary_wrapListenerBlock_1j7ar3u( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_rvgf02( +external ffi.Pointer _SwiftLibrary_wrapListenerBlock_rvgf02( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_ukcdfq( +external ffi.Pointer _SwiftLibrary_wrapListenerBlock_ukcdfq( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_1tjlcwl( +external ffi.Pointer + _SwiftLibrary_wrapListenerBlock_1tjlcwl( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_hepzs( +external ffi.Pointer _SwiftLibrary_wrapListenerBlock_hepzs( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_117qins( +external ffi.Pointer + _SwiftLibrary_wrapListenerBlock_117qins( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_9w6y6n( +external ffi.Pointer _SwiftLibrary_wrapListenerBlock_9w6y6n( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_tenbla( +external ffi.Pointer _SwiftLibrary_wrapListenerBlock_tenbla( ffi.Pointer block, ); @ffi.Native< ffi.Pointer Function( ffi.Pointer)>(isLeaf: true) -external ffi.Pointer _wrapListenerBlock_hfhq9m( +external ffi.Pointer _SwiftLibrary_wrapListenerBlock_hfhq9m( ffi.Pointer block, ); @@ -255,7 +259,7 @@ abstract final class ObjCBlock_ffiVoid { static objc.ObjCBlock listener(void Function() fn) { final raw = objc.newClosureBlock( _ObjCBlock_ffiVoid_listenerCallable.nativeFunction.cast(), () => fn()); - final wrapper = _wrapListenerBlock_ksby9f(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ksby9f(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -522,7 +526,7 @@ abstract final class ObjCBlock_ffiVoid_objcObjCObject_objcObjCObject_bool { ffi.Pointer arg2) => fn(objc.ObjCObjectBase(arg0, retain: false, release: true), objc.ObjCObjectBase(arg1, retain: false, release: true), arg2)); - final wrapper = _wrapListenerBlock_1k41wmu(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_1k41wmu(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function( @@ -1634,7 +1638,7 @@ abstract final class ObjCBlock_ffiVoid_ffiVoid_NSCoder { (ffi.Pointer arg0, ffi.Pointer arg1) => fn( arg0, objc.NSCoder.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_sjfpmz(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_sjfpmz(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(ffi.Pointer, objc.NSCoder)>(wrapper, @@ -2093,7 +2097,7 @@ abstract final class ObjCBlock_ffiVoid_NSDictionary_NSRange_bool { retain: false, release: true), arg1, arg2)); - final wrapper = _wrapListenerBlock_1j7ar3u(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_1j7ar3u(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSDictionary, objc.NSRange, @@ -2279,7 +2283,7 @@ abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSRange_bool { : objc.ObjCObjectBase(arg0, retain: false, release: true), arg1, arg2)); - final wrapper = _wrapListenerBlock_1j7ar3u(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_1j7ar3u(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(ffi.Pointer?, objc.NSRange, @@ -6591,7 +6595,7 @@ abstract final class ObjCBlock_ffiVoid_NSDate_bool_bool { retain: false, release: true), arg1, arg2)); - final wrapper = _wrapListenerBlock_rvgf02(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_rvgf02(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSDate?, ffi.Bool, @@ -12145,7 +12149,7 @@ abstract final class ObjCBlock_ffiVoid_NSFileHandle { _ObjCBlock_ffiVoid_NSFileHandle_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn( NSFileHandle.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -12831,7 +12835,7 @@ abstract final class ObjCBlock_ffiVoid_NSError { ? null : objc.NSError.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -13607,7 +13611,7 @@ abstract final class ObjCBlock_ffiVoid_NSDictionary_NSError { ? null : objc.NSError.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_1tjlcwl(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock( wrapper, @@ -15800,7 +15804,7 @@ abstract final class ObjCBlock_ffiVoid_ffiVoid { final raw = objc.newClosureBlock( _ObjCBlock_ffiVoid_ffiVoid_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn(arg0)); - final wrapper = _wrapListenerBlock_hepzs(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_hepzs(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock)>(wrapper, retain: false, release: true); @@ -17383,7 +17387,7 @@ abstract final class ObjCBlock_ffiVoid_NSArray { ? null : objc.NSArray.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -22369,7 +22373,7 @@ abstract final class ObjCBlock_ffiVoid_bool { final raw = objc.newClosureBlock( _ObjCBlock_ffiVoid_bool_listenerCallable.nativeFunction.cast(), (bool arg0) => fn(arg0)); - final wrapper = _wrapListenerBlock_117qins(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_117qins(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -23098,7 +23102,7 @@ abstract final class ObjCBlock_ffiVoid_NSTextCheckingResult_NSMatchingFlags_bool retain: false, release: true), NSMatchingFlags.fromValue(arg1), arg2)); - final wrapper = _wrapListenerBlock_9w6y6n(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_9w6y6n(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(NSTextCheckingResult?, ffi.UnsignedLong, @@ -24422,7 +24426,7 @@ abstract final class ObjCBlock_ffiVoid_NSTimer { _ObjCBlock_ffiVoid_NSTimer_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn(NSTimer.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -25361,7 +25365,7 @@ abstract final class ObjCBlock_ffiVoid_NSCachedURLResponse { ? null : NSCachedURLResponse.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -25837,7 +25841,7 @@ abstract final class ObjCBlock_ffiVoid_NSURLResponse_NSData_NSError { ? null : objc.NSError.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_tenbla(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(NSURLResponse?, objc.NSData?, @@ -25996,7 +26000,7 @@ abstract final class ObjCBlock_ffiVoid_objcObjCObject_NSError { : objc.ObjCObjectBase(arg0, retain: false, release: true), objc.NSError.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_1tjlcwl(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(ffi.Pointer?, @@ -27087,7 +27091,7 @@ abstract final class ObjCBlock_ffiVoid_NSDictionary { ? null : objc.NSDictionary.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -27235,7 +27239,7 @@ abstract final class ObjCBlock_ffiVoid_NSURLCredential { ? null : NSURLCredential.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -30188,7 +30192,7 @@ abstract final class ObjCBlock_ffiVoid_NSArray_NSArray_NSArray { retain: false, release: true), objc.NSArray.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_tenbla(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSArray, objc.NSArray, @@ -30317,7 +30321,7 @@ abstract final class ObjCBlock_ffiVoid_NSArray1 { _ObjCBlock_ffiVoid_NSArray1_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn( objc.NSArray.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -30444,7 +30448,7 @@ abstract final class ObjCBlock_ffiVoid_NSData { (ffi.Pointer arg0) => fn(arg0.address == 0 ? null : objc.NSData.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); @@ -30920,7 +30924,7 @@ abstract final class ObjCBlock_ffiVoid_NSData_bool_NSError { ? null : objc.NSError.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_hfhq9m(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_hfhq9m(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSData, ffi.Bool, objc.NSError?)>(wrapper, @@ -31943,7 +31947,7 @@ abstract final class ObjCBlock_ffiVoid_NSURLSessionWebSocketMessage_NSError { ? null : objc.NSError.castFromPointer(arg1, retain: false, release: true))); - final wrapper = _wrapListenerBlock_1tjlcwl(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_1tjlcwl(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(NSURLSessionWebSocketMessage?, @@ -32404,7 +32408,7 @@ abstract final class ObjCBlock_ffiVoid_NSData_NSURLResponse_NSError { ? null : objc.NSError.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_tenbla(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSData?, NSURLResponse?, @@ -32616,7 +32620,7 @@ abstract final class ObjCBlock_ffiVoid_NSURL_NSURLResponse_NSError { ? null : objc.NSError.castFromPointer(arg2, retain: false, release: true))); - final wrapper = _wrapListenerBlock_tenbla(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_tenbla(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock< ffi.Void Function(objc.NSURL?, NSURLResponse?, @@ -33373,7 +33377,7 @@ abstract final class ObjCBlock_ffiVoid_NSTask { _ObjCBlock_ffiVoid_NSTask_listenerCallable.nativeFunction.cast(), (ffi.Pointer arg0) => fn(NSTask.castFromPointer(arg0, retain: false, release: true))); - final wrapper = _wrapListenerBlock_ukcdfq(raw); + final wrapper = _SwiftLibrary_wrapListenerBlock_ukcdfq(raw); objc.objectRelease(raw.cast()); return objc.ObjCBlock(wrapper, retain: false, release: true); diff --git a/pkgs/ffigen/example/swift/swift_api_bindings.dart.m b/pkgs/ffigen/example/swift/swift_api_bindings.dart.m index 450d757ee..ae7f3c41c 100644 --- a/pkgs/ffigen/example/swift/swift_api_bindings.dart.m +++ b/pkgs/ffigen/example/swift/swift_api_bindings.dart.m @@ -9,7 +9,7 @@ id objc_retainBlock(id); typedef void (^_ListenerTrampoline)(); -_ListenerTrampoline _wrapListenerBlock_ksby9f(_ListenerTrampoline block) NS_RETURNS_RETAINED { +_ListenerTrampoline _SwiftLibrary_wrapListenerBlock_ksby9f(_ListenerTrampoline block) NS_RETURNS_RETAINED { return ^void() { objc_retainBlock(block); block(); @@ -17,7 +17,7 @@ _ListenerTrampoline _wrapListenerBlock_ksby9f(_ListenerTrampoline block) NS_RETU } typedef void (^_ListenerTrampoline1)(id arg0, id arg1, BOOL * arg2); -_ListenerTrampoline1 _wrapListenerBlock_1k41wmu(_ListenerTrampoline1 block) NS_RETURNS_RETAINED { +_ListenerTrampoline1 _SwiftLibrary_wrapListenerBlock_1k41wmu(_ListenerTrampoline1 block) NS_RETURNS_RETAINED { return ^void(id arg0, id arg1, BOOL * arg2) { objc_retainBlock(block); block(objc_retain(arg0), objc_retain(arg1), arg2); @@ -25,7 +25,7 @@ _ListenerTrampoline1 _wrapListenerBlock_1k41wmu(_ListenerTrampoline1 block) NS_R } typedef void (^_ListenerTrampoline2)(void * arg0, id arg1); -_ListenerTrampoline2 _wrapListenerBlock_sjfpmz(_ListenerTrampoline2 block) NS_RETURNS_RETAINED { +_ListenerTrampoline2 _SwiftLibrary_wrapListenerBlock_sjfpmz(_ListenerTrampoline2 block) NS_RETURNS_RETAINED { return ^void(void * arg0, id arg1) { objc_retainBlock(block); block(arg0, objc_retain(arg1)); @@ -33,7 +33,7 @@ _ListenerTrampoline2 _wrapListenerBlock_sjfpmz(_ListenerTrampoline2 block) NS_RE } typedef void (^_ListenerTrampoline3)(id arg0, struct _NSRange arg1, BOOL * arg2); -_ListenerTrampoline3 _wrapListenerBlock_1j7ar3u(_ListenerTrampoline3 block) NS_RETURNS_RETAINED { +_ListenerTrampoline3 _SwiftLibrary_wrapListenerBlock_1j7ar3u(_ListenerTrampoline3 block) NS_RETURNS_RETAINED { return ^void(id arg0, struct _NSRange arg1, BOOL * arg2) { objc_retainBlock(block); block(objc_retain(arg0), arg1, arg2); @@ -41,7 +41,7 @@ _ListenerTrampoline3 _wrapListenerBlock_1j7ar3u(_ListenerTrampoline3 block) NS_R } typedef void (^_ListenerTrampoline4)(id arg0, BOOL arg1, BOOL * arg2); -_ListenerTrampoline4 _wrapListenerBlock_rvgf02(_ListenerTrampoline4 block) NS_RETURNS_RETAINED { +_ListenerTrampoline4 _SwiftLibrary_wrapListenerBlock_rvgf02(_ListenerTrampoline4 block) NS_RETURNS_RETAINED { return ^void(id arg0, BOOL arg1, BOOL * arg2) { objc_retainBlock(block); block(objc_retain(arg0), arg1, arg2); @@ -49,7 +49,7 @@ _ListenerTrampoline4 _wrapListenerBlock_rvgf02(_ListenerTrampoline4 block) NS_RE } typedef void (^_ListenerTrampoline5)(id arg0); -_ListenerTrampoline5 _wrapListenerBlock_ukcdfq(_ListenerTrampoline5 block) NS_RETURNS_RETAINED { +_ListenerTrampoline5 _SwiftLibrary_wrapListenerBlock_ukcdfq(_ListenerTrampoline5 block) NS_RETURNS_RETAINED { return ^void(id arg0) { objc_retainBlock(block); block(objc_retain(arg0)); @@ -57,7 +57,7 @@ _ListenerTrampoline5 _wrapListenerBlock_ukcdfq(_ListenerTrampoline5 block) NS_RE } typedef void (^_ListenerTrampoline6)(id arg0, id arg1); -_ListenerTrampoline6 _wrapListenerBlock_1tjlcwl(_ListenerTrampoline6 block) NS_RETURNS_RETAINED { +_ListenerTrampoline6 _SwiftLibrary_wrapListenerBlock_1tjlcwl(_ListenerTrampoline6 block) NS_RETURNS_RETAINED { return ^void(id arg0, id arg1) { objc_retainBlock(block); block(objc_retain(arg0), objc_retain(arg1)); @@ -65,7 +65,7 @@ _ListenerTrampoline6 _wrapListenerBlock_1tjlcwl(_ListenerTrampoline6 block) NS_R } typedef void (^_ListenerTrampoline7)(void * arg0); -_ListenerTrampoline7 _wrapListenerBlock_hepzs(_ListenerTrampoline7 block) NS_RETURNS_RETAINED { +_ListenerTrampoline7 _SwiftLibrary_wrapListenerBlock_hepzs(_ListenerTrampoline7 block) NS_RETURNS_RETAINED { return ^void(void * arg0) { objc_retainBlock(block); block(arg0); @@ -73,7 +73,7 @@ _ListenerTrampoline7 _wrapListenerBlock_hepzs(_ListenerTrampoline7 block) NS_RET } typedef void (^_ListenerTrampoline8)(BOOL arg0); -_ListenerTrampoline8 _wrapListenerBlock_117qins(_ListenerTrampoline8 block) NS_RETURNS_RETAINED { +_ListenerTrampoline8 _SwiftLibrary_wrapListenerBlock_117qins(_ListenerTrampoline8 block) NS_RETURNS_RETAINED { return ^void(BOOL arg0) { objc_retainBlock(block); block(arg0); @@ -81,7 +81,7 @@ _ListenerTrampoline8 _wrapListenerBlock_117qins(_ListenerTrampoline8 block) NS_R } typedef void (^_ListenerTrampoline9)(id arg0, NSMatchingFlags arg1, BOOL * arg2); -_ListenerTrampoline9 _wrapListenerBlock_9w6y6n(_ListenerTrampoline9 block) NS_RETURNS_RETAINED { +_ListenerTrampoline9 _SwiftLibrary_wrapListenerBlock_9w6y6n(_ListenerTrampoline9 block) NS_RETURNS_RETAINED { return ^void(id arg0, NSMatchingFlags arg1, BOOL * arg2) { objc_retainBlock(block); block(objc_retain(arg0), arg1, arg2); @@ -89,7 +89,7 @@ _ListenerTrampoline9 _wrapListenerBlock_9w6y6n(_ListenerTrampoline9 block) NS_RE } typedef void (^_ListenerTrampoline10)(id arg0, id arg1, id arg2); -_ListenerTrampoline10 _wrapListenerBlock_tenbla(_ListenerTrampoline10 block) NS_RETURNS_RETAINED { +_ListenerTrampoline10 _SwiftLibrary_wrapListenerBlock_tenbla(_ListenerTrampoline10 block) NS_RETURNS_RETAINED { return ^void(id arg0, id arg1, id arg2) { objc_retainBlock(block); block(objc_retain(arg0), objc_retain(arg1), objc_retain(arg2)); @@ -97,7 +97,7 @@ _ListenerTrampoline10 _wrapListenerBlock_tenbla(_ListenerTrampoline10 block) NS_ } typedef void (^_ListenerTrampoline11)(id arg0, BOOL arg1, id arg2); -_ListenerTrampoline11 _wrapListenerBlock_hfhq9m(_ListenerTrampoline11 block) NS_RETURNS_RETAINED { +_ListenerTrampoline11 _SwiftLibrary_wrapListenerBlock_hfhq9m(_ListenerTrampoline11 block) NS_RETURNS_RETAINED { return ^void(id arg0, BOOL arg1, id arg2) { objc_retainBlock(block); block(objc_retain(arg0), arg1, objc_retain(arg2)); diff --git a/pkgs/ffigen/lib/src/code_generator/library.dart b/pkgs/ffigen/lib/src/code_generator/library.dart index 9f70a6055..9bf425beb 100644 --- a/pkgs/ffigen/lib/src/code_generator/library.dart +++ b/pkgs/ffigen/lib/src/code_generator/library.dart @@ -5,6 +5,7 @@ import 'dart:io'; import 'package:collection/collection.dart'; +import 'package:dart_style/dart_style.dart'; import 'package:logging/logging.dart'; import 'package:yaml_edit/yaml_edit.dart'; @@ -160,10 +161,11 @@ class Library { /// generated file. void generateFile(File file, {bool format = true}) { if (!file.existsSync()) file.createSync(recursive: true); - file.writeAsStringSync(generate()); + var bindings = generate(); if (format) { - _dartFormat(file.path); + bindings = _dartFormat(bindings); } + file.writeAsStringSync(bindings); } /// Generates [file] with the Objective C code needed for the bindings, if @@ -199,14 +201,10 @@ class Library { } /// Formats a file using the Dart formatter. - void _dartFormat(String path) { - final result = Process.runSync(findDart(), ['format', path], - workingDirectory: Directory.current.absolute.path, - runInShell: Platform.isWindows); - if (result.stderr.toString().isNotEmpty) { - _logger.severe(result.stderr); - throw FormatException('Unable to format generated file: $path.'); - } + String _dartFormat(String contents) { + final formatter = + DartFormatter(languageVersion: DartFormatter.latestLanguageVersion); + return formatter.format(contents); } /// Generates the bindings. diff --git a/pkgs/ffigen/pubspec.yaml b/pkgs/ffigen/pubspec.yaml index 4d3ebe3c2..e5724f40b 100644 --- a/pkgs/ffigen/pubspec.yaml +++ b/pkgs/ffigen/pubspec.yaml @@ -20,6 +20,7 @@ dependencies: args: ^2.0.0 cli_util: ^0.4.0 collection: ^1.18.0 + dart_style: ^2.3.7 ffi: ^2.0.1 file: ^7.0.0 glob: ^2.0.0