Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
Fix doc comment missing on struct/union array fields, update test, ve…
Browse files Browse the repository at this point in the history
…rsion, changelog
  • Loading branch information
mannprerak2 committed Jul 22, 2023
1 parent d46d4fd commit 341237b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 9.0.1

- Fix doc comment missing on struct/union array fields.

# 9.0.0

- Added a JSON schema for FFIgen config files.
Expand Down
10 changes: 5 additions & 5 deletions lib/src/code_generator/compound.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@ abstract class Compound extends BindingType {
const depth = ' ';
for (final m in members) {
m.name = localUniqueNamer.makeUnique(m.name);
if (m.dartDoc != null) {
s.write('$depth/// ');
s.writeAll(m.dartDoc!.split('\n'), '\n$depth/// ');
s.write('\n');
}
if (m.type is ConstantArray) {
s.write('$depth@${w.ffiLibraryPrefix}.Array.multi(');
s.write('${_getArrayDimensionLengths(m.type)})\n');
s.write('${depth}external ${_getInlineArrayTypeString(m.type, w)} ');
s.write('${m.name};\n\n');
} else {
if (m.dartDoc != null) {
s.write('$depth/// ');
s.writeAll(m.dartDoc!.split('\n'), '\n$depth/// ');
s.write('\n');
}
if (!sameDartAndCType(m.type, w)) {
s.write('$depth@${m.type.getCType(w)}()\n');
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.

name: ffigen
version: 9.0.0
version: 9.0.1
description: Generator for FFI bindings, using LibClang to parse C header files.
repository: https://github.com/dart-lang/ffigen

Expand Down
3 changes: 3 additions & 0 deletions test/header_parser_tests/comment_markup.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ struct Com4{

/* Single line field comment. */
float b;

/* Comment on array member */
int c[3];
};
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ final class Com4 extends ffi.Struct {
/// Single line field comment.
@ffi.Float()
external double b;

/// Comment on array member
@ffi.Array.multi([3])
external ffi.Array<ffi.Int> c;
}

0 comments on commit 341237b

Please sign in to comment.