-
Notifications
You must be signed in to change notification settings - Fork 55
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm w comments
Thanks @liamappelbe!
@@ -10990,7 +11142,6 @@ final class IndexerCallbacks extends ffi.Struct { | |||
CXIdxClientContainer Function( | |||
CXClientData client_data, ffi.Pointer<ffi.Void> reserved)>> | |||
startedTranslationUnit; | |||
|
|||
external ffi.Pointer< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the declarations separeted by newlines, that's more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know when this change happened, but it's not caused by this PR. I'm just the first one to regenerate this file in a while. We didn't notice the change because our unit tests were intentionally ignoring all the empty lines when diffing the expected and actual output. I've removed this behavior so we'll notice such changes in future.
lib/src/code_generator/type.dart
Outdated
@@ -48,6 +48,12 @@ abstract class Type { | |||
/// as getFfiDartType. For ObjC bindings this refers to the wrapper object. | |||
String getDartType(Writer w) => getFfiDartType(w); | |||
|
|||
/// Returns whether the FFI dart type and C type string are same. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe refer to the methods above with []
so it's easier to understand.
Avoid "Return"s.
lib/src/code_generator/type.dart
Outdated
@@ -48,6 +48,12 @@ abstract class Type { | |||
/// as getFfiDartType. For ObjC bindings this refers to the wrapper object. | |||
String getDartType(Writer w) => getFfiDartType(w); | |||
|
|||
/// Returns whether the FFI dart type and C type string are same. | |||
bool get sameFfiDartAndCType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename to ffiDartAndCTypeEqual
. "Equal" seems a more logical word to use than "same".
Also, can we use foo.getCType() == foo.getFfiDartType()
on the call-sites and avoid declaring this method? (I know we had this structure already before the PR, so feel free to punt to a separate refactoring.)
For typedefs that have a different
getDartType
to theirgetFfiDartType
orgetCType
(whichever is used in the existing typedef), define a second typedef that uses thegetDartType
, with anDart
prefix.Fixes dart-lang/native#235
Example (from the new objc typedef test):
Generates: