dart-native / codegen

Generator for dart_native bindings. Codegen can transform native SDK to Flutter plugin.
BSD 3-Clause "New" or "Revised" License
79 stars 3 forks source link

Block 返回值带 `_Nonnull` 修饰时的 bug #30

Closed yulingtianxia closed 4 years ago

yulingtianxia commented 4 years ago

返回值带 _Nonnull 的场景 case:

typedef NSObject *_Nonnull (^BarBlock)(NSObject *a);

输出的 dart 代码:

typedef NSObject _Nonnull BarBlock(NSObject a);

建议修改的位置:

// FIXME: type with _Nonnull will cause a error. Try this:
// var type = ctx.start.text
// if (type == 'void' || type == 'char') {type += ' *'}
var type = ctx.start.text + (ctx.start.start != ctx.stop.start ? ' ' + ctx.stop.text : '')