Skip to content

Commit ff23f54

Browse files
dcharkescommit-bot@chromium.org
authored andcommitted
[vm/ffi] Work around dartdoc crash to fix API doc generation
Issue: #38786 Change-Id: Ida4bb78da1aabdf6da259e0d66840d9db4b1428d Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120788 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
1 parent 7a6e623 commit ff23f54

File tree

3 files changed

+254
-252
lines changed

3 files changed

+254
-252
lines changed

runtime/tools/ffi/sdk_lib_ffi_generator.dart

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ void generateHeader(StringBuffer buffer) {
7373
void generatePublicExtension(
7474
StringBuffer buffer, String nativeType, String dartType) {
7575
final storeTrunctateInt = """
76-
/// Note that ints which do not fit in [$nativeType] are truncated.
76+
/// Note that ints which do not fit in `$nativeType` are truncated.
7777
""";
7878

7979
final storeTrunctateDouble = """
80-
/// Note that doubles stored into Pointer<[Float]> lose precision.
80+
/// Note that doubles stored into Pointer<`Float`> lose precision.
8181
""";
8282

8383
final storeTruncate =
@@ -89,35 +89,37 @@ void generatePublicExtension(
8989

9090
final loadSignExtend = isInt(nativeType) ? loadSignExtendInt : "";
9191

92+
// TODO(dartdoc-bug): Use [] instead of ``, once issue
93+
// https://github.com/dart-lang/dartdoc/issues/2039 is fixed.
9294
buffer.write("""
9395
/// Extension on [Pointer] specialized for the type argument [$nativeType].
9496
extension ${nativeType}Pointer on Pointer<$nativeType> {
9597
/// Load a Dart value from this location.
9698
///
9799
/// The value is automatically unmarshalled from its native representation.
98100
$loadSignExtend ///
99-
/// Note that [address] needs to be aligned to the size of [$nativeType].
101+
/// Note that `address` needs to be aligned to the size of `$nativeType`.
100102
external $dartType get value;
101103
102104
/// Store a Dart value into this location.
103105
///
104-
/// The [value] is automatically marshalled into its native representation.
106+
/// The `value` is automatically marshalled into its native representation.
105107
$storeTruncate ///
106-
/// Note that [address] needs to be aligned to the size of [$nativeType].
108+
/// Note that `address` needs to be aligned to the size of `$nativeType`.
107109
external void set value($dartType value);
108110
109-
/// Load a Dart value from this location offset by [index].
111+
/// Load a Dart value from this location offset by `index`.
110112
///
111113
/// The value is automatically unmarshalled from its native representation.
112114
$loadSignExtend ///
113-
/// Note that [address] needs to be aligned to the size of [$nativeType].
115+
/// Note that `address` needs to be aligned to the size of `$nativeType`.
114116
external $dartType operator [](int index);
115117
116-
/// Store a Dart value into this location offset by [index].
118+
/// Store a Dart value into this location offset by `index`.
117119
///
118-
/// The [value] is automatically marshalled into its native representation.
120+
/// The `value` is automatically marshalled into its native representation.
119121
$storeTruncate ///
120-
/// Note that [address] needs to be aligned to the size of [$nativeType].
122+
/// Note that `address` needs to be aligned to the size of `$nativeType`.
121123
external void operator []=(int index, $dartType value);
122124
}
123125

0 commit comments

Comments
 (0)