Skip to content

Commit 8409db1

Browse files
committed
Dart: list field ctor params using bullet points
DartDoc uses markdown. The bullet points should be used for describing parameters of constructors and functions. Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
1 parent b2419dc commit 8409db1

7 files changed

Lines changed: 118 additions & 13 deletions

File tree

gluecodium/src/main/resources/templates/dart/DartStructConstructors.mustache

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ Explicit `field constructor` definitions
7878
}}{{#set struct=this container=this}}{{#fieldConstructors}}
7979
{{#unless comment.isEmpty}}{{#resolveName comment}}{{#unless this.isEmpty}}{{!!
8080
}}{{prefix this " /// "}}
81-
{{#fields}}
82-
/// [{{resolveName}}] {{#resolveName comment}}{{#unless this.isEmpty}}{{!!
83-
}}{{prefix this " /// " skipFirstLine=true}}{{/unless}}{{/resolveName}}
81+
{{#fields}}{{!!
82+
}} /// - [{{resolveName}}] {{#resolveName comment}}{{#unless this.isEmpty}}{{!!
83+
}}{{prefix this " /// " skipFirstLine=true}}{{/unless}}{{/resolveName}}
8484
{{/fields}}{{/unless}}{{/resolveName}}{{/unless}}{{!!
8585
}}{{#if comment.isEmpty}}{{#resolveName constructorComment}}{{#unless this.isEmpty}}{{!!
8686
}}{{prefix this " /// "}}
87-
{{#fields}}
88-
/// [{{resolveName}}] {{#resolveName comment}}{{#unless this.isEmpty}}{{!!
89-
}}{{prefix this " /// " skipFirstLine=true}}{{/unless}}{{/resolveName}}
87+
{{#fields}}{{!!
88+
}} /// - [{{resolveName}}] {{#resolveName comment}}{{#unless this.isEmpty}}{{!!
89+
}}{{prefix this " /// " skipFirstLine=true}}{{/unless}}{{/resolveName}}
9090
{{/fields}}{{/unless}}{{/resolveName}}{{/if}}{{!!
9191
}}{{#if this.comment.isExcluded}}
9292
/// @nodoc

gluecodium/src/test/resources/smoke/field_constructors/output/dart/lib/src/smoke/field_constructor_with_both_comments.dart

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1+
2+
13
import 'dart:ffi';
24
import 'package:library/src/_library_context.dart' as __lib;
35
import 'package:library/src/builtin_types__conversion.dart';
6+
47
/// SomeStruct
8+
59
class FieldConstructorWithBothComments {
610
String stringField;
11+
712
/// This comment takes precedence
8-
/// [stringField]
13+
/// - [stringField]
914
FieldConstructorWithBothComments(this.stringField);
1015
}
16+
17+
1118
// FieldConstructorWithBothComments "private" section, not exported.
19+
1220
final _smokeFieldconstructorwithbothcommentsCreateHandle = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
1321
Pointer<Void> Function(Pointer<Void>),
1422
Pointer<Void> Function(Pointer<Void>)
@@ -21,12 +29,16 @@ final _smokeFieldconstructorwithbothcommentsGetFieldstringField = __lib.catchArg
2129
Pointer<Void> Function(Pointer<Void>),
2230
Pointer<Void> Function(Pointer<Void>)
2331
>('library_smoke_FieldConstructorWithBothComments_get_field_stringField'));
32+
33+
34+
2435
Pointer<Void> smokeFieldconstructorwithbothcommentsToFfi(FieldConstructorWithBothComments value) {
2536
final _stringFieldHandle = stringToFfi(value.stringField);
2637
final _result = _smokeFieldconstructorwithbothcommentsCreateHandle(_stringFieldHandle);
2738
stringReleaseFfiHandle(_stringFieldHandle);
2839
return _result;
2940
}
41+
3042
FieldConstructorWithBothComments smokeFieldconstructorwithbothcommentsFromFfi(Pointer<Void> handle) {
3143
final _stringFieldHandle = _smokeFieldconstructorwithbothcommentsGetFieldstringField(handle);
3244
try {
@@ -37,8 +49,11 @@ FieldConstructorWithBothComments smokeFieldconstructorwithbothcommentsFromFfi(Po
3749
stringReleaseFfiHandle(_stringFieldHandle);
3850
}
3951
}
52+
4053
void smokeFieldconstructorwithbothcommentsReleaseFfiHandle(Pointer<Void> handle) => _smokeFieldconstructorwithbothcommentsReleaseHandle(handle);
54+
4155
// Nullable FieldConstructorWithBothComments
56+
4257
final _smokeFieldconstructorwithbothcommentsCreateHandleNullable = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
4358
Pointer<Void> Function(Pointer<Void>),
4459
Pointer<Void> Function(Pointer<Void>)
@@ -51,20 +66,26 @@ final _smokeFieldconstructorwithbothcommentsGetValueNullable = __lib.catchArgume
5166
Pointer<Void> Function(Pointer<Void>),
5267
Pointer<Void> Function(Pointer<Void>)
5368
>('library_smoke_FieldConstructorWithBothComments_get_value_nullable'));
69+
5470
Pointer<Void> smokeFieldconstructorwithbothcommentsToFfiNullable(FieldConstructorWithBothComments? value) {
5571
if (value == null) return Pointer<Void>.fromAddress(0);
5672
final _handle = smokeFieldconstructorwithbothcommentsToFfi(value);
5773
final result = _smokeFieldconstructorwithbothcommentsCreateHandleNullable(_handle);
5874
smokeFieldconstructorwithbothcommentsReleaseFfiHandle(_handle);
5975
return result;
6076
}
77+
6178
FieldConstructorWithBothComments? smokeFieldconstructorwithbothcommentsFromFfiNullable(Pointer<Void> handle) {
6279
if (handle.address == 0) return null;
6380
final _handle = _smokeFieldconstructorwithbothcommentsGetValueNullable(handle);
6481
final result = smokeFieldconstructorwithbothcommentsFromFfi(_handle);
6582
smokeFieldconstructorwithbothcommentsReleaseFfiHandle(_handle);
6683
return result;
6784
}
85+
6886
void smokeFieldconstructorwithbothcommentsReleaseFfiHandleNullable(Pointer<Void> handle) =>
6987
_smokeFieldconstructorwithbothcommentsReleaseHandleNullable(handle);
88+
7089
// End of FieldConstructorWithBothComments "private" section.
90+
91+

gluecodium/src/test/resources/smoke/field_constructors/output/dart/lib/src/smoke/field_constructor_with_comment.dart

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
2+
13
import 'dart:ffi';
24
import 'package:library/src/_library_context.dart' as __lib;
35
import 'package:library/src/builtin_types__conversion.dart';
6+
47
/// SomeStruct
8+
59
class FieldConstructorWithComment {
610
/// Some field
711
String stringField;
12+
813
/// Some field constructor
9-
/// [stringField] Some field
14+
/// - [stringField] Some field
1015
FieldConstructorWithComment(this.stringField);
1116
}
17+
18+
1219
// FieldConstructorWithComment "private" section, not exported.
20+
1321
final _smokeFieldconstructorwithcommentCreateHandle = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
1422
Pointer<Void> Function(Pointer<Void>),
1523
Pointer<Void> Function(Pointer<Void>)
@@ -22,12 +30,16 @@ final _smokeFieldconstructorwithcommentGetFieldstringField = __lib.catchArgument
2230
Pointer<Void> Function(Pointer<Void>),
2331
Pointer<Void> Function(Pointer<Void>)
2432
>('library_smoke_FieldConstructorWithComment_get_field_stringField'));
33+
34+
35+
2536
Pointer<Void> smokeFieldconstructorwithcommentToFfi(FieldConstructorWithComment value) {
2637
final _stringFieldHandle = stringToFfi(value.stringField);
2738
final _result = _smokeFieldconstructorwithcommentCreateHandle(_stringFieldHandle);
2839
stringReleaseFfiHandle(_stringFieldHandle);
2940
return _result;
3041
}
42+
3143
FieldConstructorWithComment smokeFieldconstructorwithcommentFromFfi(Pointer<Void> handle) {
3244
final _stringFieldHandle = _smokeFieldconstructorwithcommentGetFieldstringField(handle);
3345
try {
@@ -38,8 +50,11 @@ FieldConstructorWithComment smokeFieldconstructorwithcommentFromFfi(Pointer<Void
3850
stringReleaseFfiHandle(_stringFieldHandle);
3951
}
4052
}
53+
4154
void smokeFieldconstructorwithcommentReleaseFfiHandle(Pointer<Void> handle) => _smokeFieldconstructorwithcommentReleaseHandle(handle);
55+
4256
// Nullable FieldConstructorWithComment
57+
4358
final _smokeFieldconstructorwithcommentCreateHandleNullable = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
4459
Pointer<Void> Function(Pointer<Void>),
4560
Pointer<Void> Function(Pointer<Void>)
@@ -52,20 +67,26 @@ final _smokeFieldconstructorwithcommentGetValueNullable = __lib.catchArgumentErr
5267
Pointer<Void> Function(Pointer<Void>),
5368
Pointer<Void> Function(Pointer<Void>)
5469
>('library_smoke_FieldConstructorWithComment_get_value_nullable'));
70+
5571
Pointer<Void> smokeFieldconstructorwithcommentToFfiNullable(FieldConstructorWithComment? value) {
5672
if (value == null) return Pointer<Void>.fromAddress(0);
5773
final _handle = smokeFieldconstructorwithcommentToFfi(value);
5874
final result = _smokeFieldconstructorwithcommentCreateHandleNullable(_handle);
5975
smokeFieldconstructorwithcommentReleaseFfiHandle(_handle);
6076
return result;
6177
}
78+
6279
FieldConstructorWithComment? smokeFieldconstructorwithcommentFromFfiNullable(Pointer<Void> handle) {
6380
if (handle.address == 0) return null;
6481
final _handle = _smokeFieldconstructorwithcommentGetValueNullable(handle);
6582
final result = smokeFieldconstructorwithcommentFromFfi(_handle);
6683
smokeFieldconstructorwithcommentReleaseFfiHandle(_handle);
6784
return result;
6885
}
86+
6987
void smokeFieldconstructorwithcommentReleaseFfiHandleNullable(Pointer<Void> handle) =>
7088
_smokeFieldconstructorwithcommentReleaseHandleNullable(handle);
89+
7190
// End of FieldConstructorWithComment "private" section.
91+
92+

gluecodium/src/test/resources/smoke/field_constructors/output/dart/lib/src/smoke/field_constructor_with_deprecation_and_comment.dart

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1+
2+
13
import 'dart:ffi';
24
import 'package:library/src/_library_context.dart' as __lib;
35
import 'package:library/src/builtin_types__conversion.dart';
6+
7+
48
class FieldConstructorWithDeprecationAndComment {
59
String stringField;
10+
611
/// Some field constructor
7-
/// [stringField]
12+
/// - [stringField]
813
@Deprecated("Shouldn't really use it")
914
FieldConstructorWithDeprecationAndComment(this.stringField);
1015
}
16+
17+
1118
// FieldConstructorWithDeprecationAndComment "private" section, not exported.
19+
1220
final _smokeFieldconstructorwithdeprecationandcommentCreateHandle = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
1321
Pointer<Void> Function(Pointer<Void>),
1422
Pointer<Void> Function(Pointer<Void>)
@@ -21,12 +29,16 @@ final _smokeFieldconstructorwithdeprecationandcommentGetFieldstringField = __lib
2129
Pointer<Void> Function(Pointer<Void>),
2230
Pointer<Void> Function(Pointer<Void>)
2331
>('library_smoke_FieldConstructorWithDeprecationAndComment_get_field_stringField'));
32+
33+
34+
2435
Pointer<Void> smokeFieldconstructorwithdeprecationandcommentToFfi(FieldConstructorWithDeprecationAndComment value) {
2536
final _stringFieldHandle = stringToFfi(value.stringField);
2637
final _result = _smokeFieldconstructorwithdeprecationandcommentCreateHandle(_stringFieldHandle);
2738
stringReleaseFfiHandle(_stringFieldHandle);
2839
return _result;
2940
}
41+
3042
FieldConstructorWithDeprecationAndComment smokeFieldconstructorwithdeprecationandcommentFromFfi(Pointer<Void> handle) {
3143
final _stringFieldHandle = _smokeFieldconstructorwithdeprecationandcommentGetFieldstringField(handle);
3244
try {
@@ -37,8 +49,11 @@ FieldConstructorWithDeprecationAndComment smokeFieldconstructorwithdeprecationan
3749
stringReleaseFfiHandle(_stringFieldHandle);
3850
}
3951
}
52+
4053
void smokeFieldconstructorwithdeprecationandcommentReleaseFfiHandle(Pointer<Void> handle) => _smokeFieldconstructorwithdeprecationandcommentReleaseHandle(handle);
54+
4155
// Nullable FieldConstructorWithDeprecationAndComment
56+
4257
final _smokeFieldconstructorwithdeprecationandcommentCreateHandleNullable = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
4358
Pointer<Void> Function(Pointer<Void>),
4459
Pointer<Void> Function(Pointer<Void>)
@@ -51,20 +66,26 @@ final _smokeFieldconstructorwithdeprecationandcommentGetValueNullable = __lib.ca
5166
Pointer<Void> Function(Pointer<Void>),
5267
Pointer<Void> Function(Pointer<Void>)
5368
>('library_smoke_FieldConstructorWithDeprecationAndComment_get_value_nullable'));
69+
5470
Pointer<Void> smokeFieldconstructorwithdeprecationandcommentToFfiNullable(FieldConstructorWithDeprecationAndComment? value) {
5571
if (value == null) return Pointer<Void>.fromAddress(0);
5672
final _handle = smokeFieldconstructorwithdeprecationandcommentToFfi(value);
5773
final result = _smokeFieldconstructorwithdeprecationandcommentCreateHandleNullable(_handle);
5874
smokeFieldconstructorwithdeprecationandcommentReleaseFfiHandle(_handle);
5975
return result;
6076
}
77+
6178
FieldConstructorWithDeprecationAndComment? smokeFieldconstructorwithdeprecationandcommentFromFfiNullable(Pointer<Void> handle) {
6279
if (handle.address == 0) return null;
6380
final _handle = _smokeFieldconstructorwithdeprecationandcommentGetValueNullable(handle);
6481
final result = smokeFieldconstructorwithdeprecationandcommentFromFfi(_handle);
6582
smokeFieldconstructorwithdeprecationandcommentReleaseFfiHandle(_handle);
6683
return result;
6784
}
85+
6886
void smokeFieldconstructorwithdeprecationandcommentReleaseFfiHandleNullable(Pointer<Void> handle) =>
6987
_smokeFieldconstructorwithdeprecationandcommentReleaseHandleNullable(handle);
88+
7089
// End of FieldConstructorWithDeprecationAndComment "private" section.
90+
91+

gluecodium/src/test/resources/smoke/field_constructors/output/dart/lib/src/smoke/field_constructor_with_excluded.dart

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
2+
13
import 'dart:ffi';
24
import 'package:library/src/_library_context.dart' as __lib;
35
import 'package:library/src/builtin_types__conversion.dart';
6+
7+
48
class FieldConstructorWithExcluded {
59
/// Some field
610
String stringField;
11+
712
/// Some field constructor
8-
/// [stringField] Some field
13+
/// - [stringField] Some field
914
/// @nodoc
1015
FieldConstructorWithExcluded(this.stringField);
1116
}
17+
18+
1219
// FieldConstructorWithExcluded "private" section, not exported.
20+
1321
final _smokeFieldconstructorwithexcludedCreateHandle = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
1422
Pointer<Void> Function(Pointer<Void>),
1523
Pointer<Void> Function(Pointer<Void>)
@@ -22,12 +30,16 @@ final _smokeFieldconstructorwithexcludedGetFieldstringField = __lib.catchArgumen
2230
Pointer<Void> Function(Pointer<Void>),
2331
Pointer<Void> Function(Pointer<Void>)
2432
>('library_smoke_FieldConstructorWithExcluded_get_field_stringField'));
33+
34+
35+
2536
Pointer<Void> smokeFieldconstructorwithexcludedToFfi(FieldConstructorWithExcluded value) {
2637
final _stringFieldHandle = stringToFfi(value.stringField);
2738
final _result = _smokeFieldconstructorwithexcludedCreateHandle(_stringFieldHandle);
2839
stringReleaseFfiHandle(_stringFieldHandle);
2940
return _result;
3041
}
42+
3143
FieldConstructorWithExcluded smokeFieldconstructorwithexcludedFromFfi(Pointer<Void> handle) {
3244
final _stringFieldHandle = _smokeFieldconstructorwithexcludedGetFieldstringField(handle);
3345
try {
@@ -38,8 +50,11 @@ FieldConstructorWithExcluded smokeFieldconstructorwithexcludedFromFfi(Pointer<Vo
3850
stringReleaseFfiHandle(_stringFieldHandle);
3951
}
4052
}
53+
4154
void smokeFieldconstructorwithexcludedReleaseFfiHandle(Pointer<Void> handle) => _smokeFieldconstructorwithexcludedReleaseHandle(handle);
55+
4256
// Nullable FieldConstructorWithExcluded
57+
4358
final _smokeFieldconstructorwithexcludedCreateHandleNullable = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
4459
Pointer<Void> Function(Pointer<Void>),
4560
Pointer<Void> Function(Pointer<Void>)
@@ -52,20 +67,26 @@ final _smokeFieldconstructorwithexcludedGetValueNullable = __lib.catchArgumentEr
5267
Pointer<Void> Function(Pointer<Void>),
5368
Pointer<Void> Function(Pointer<Void>)
5469
>('library_smoke_FieldConstructorWithExcluded_get_value_nullable'));
70+
5571
Pointer<Void> smokeFieldconstructorwithexcludedToFfiNullable(FieldConstructorWithExcluded? value) {
5672
if (value == null) return Pointer<Void>.fromAddress(0);
5773
final _handle = smokeFieldconstructorwithexcludedToFfi(value);
5874
final result = _smokeFieldconstructorwithexcludedCreateHandleNullable(_handle);
5975
smokeFieldconstructorwithexcludedReleaseFfiHandle(_handle);
6076
return result;
6177
}
78+
6279
FieldConstructorWithExcluded? smokeFieldconstructorwithexcludedFromFfiNullable(Pointer<Void> handle) {
6380
if (handle.address == 0) return null;
6481
final _handle = _smokeFieldconstructorwithexcludedGetValueNullable(handle);
6582
final result = smokeFieldconstructorwithexcludedFromFfi(_handle);
6683
smokeFieldconstructorwithexcludedReleaseFfiHandle(_handle);
6784
return result;
6885
}
86+
6987
void smokeFieldconstructorwithexcludedReleaseFfiHandleNullable(Pointer<Void> handle) =>
7088
_smokeFieldconstructorwithexcludedReleaseHandleNullable(handle);
89+
7190
// End of FieldConstructorWithExcluded "private" section.
91+
92+

0 commit comments

Comments
 (0)