Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve doc refs to functions as full names in Dart #647

Merged
merged 2 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### Bug fixes:
* Fixed compilation issue for collections of nullable types in Swift.
* Fixed validation false positive for constructor overloads.
* Fixed documentation comment reference resolution for functions in Dart.

## 8.6.4
Release date: 2020-11-26
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,16 @@ internal class DartNameResolver(
.toMutableMap()

val functions = limeReferenceMap.values.filterIsInstance<LimeFunction>()
result += functions.associateBy({ it.path.withSuffix("").toString() }, { resolveName(it) })
result += functions.associateBy({ it.path.withSuffix("").toString() }, { resolveFullName(it) })
result += functions.associateBy(
{ function -> function.path.withSuffix("").toString() + function.parameters
.joinToString(prefix = "(", postfix = ")", separator = ",") { it.typeRef.toString() } },
{ resolveName(it) }
{ resolveFullName(it) }
)

val properties = limeReferenceMap.values.filterIsInstance<LimeProperty>()
result += properties.associateBy({ it.fullName + ".get" }, { resolveName(it) })
result += properties.filter { it.setter != null }.associateBy({ it.fullName + ".set" }, { resolveName(it) })
result += properties.associateBy({ it.fullName + ".get" }, { resolveFullName(it) })
result += properties.filter { it.setter != null }.associateBy({ it.fullName + ".set" }, { resolveFullName(it) })

return result
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class comments {
// Not quite useful
Useless,
// Somewhat useful
Useful
USEFUL
}

// This is some very useful typedef.
Expand Down Expand Up @@ -157,7 +157,7 @@ class CommentsLinks {
// * struct: [comments.SomeStruct]
// * struct field: [comments.SomeStruct.someField]
// * enum: [comments.SomeEnum]
// * enum item: [comments.SomeEnum.Useful]
// * enum item: [comments.SomeEnum.USEFUL]
// * property: [comments.SomeProperty]
// * property setter: [comments.SomeProperty.set]
// * property getter: [comments.SomeProperty.get]
Expand All @@ -184,8 +184,8 @@ class CommentsLinks {
// Not working for Swift:
// * named comment: [Alternative name for the link, stripped for Swift][comments.VeryUseful]
//
// @param[inputParameter] Sometimes takes [comments.SomeEnum.Useful]
// @return Sometimes returns [comments.SomeEnum.Useful]
// @param[inputParameter] Sometimes takes [comments.SomeEnum.USEFUL]
// @return Sometimes returns [comments.SomeEnum.USEFUL]
// @throws May or may not throw [comments.SomethingWrong]
fun random_method(inputParameter: comments.SomeEnum): comments.SomeEnum throws comments.SomethingWrong

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'package:meta/meta.dart';
import 'package:library/src/_library_context.dart' as __lib;
/// The nested types like [randomMethod2] don't need full name prefix, but it's
/// The nested types like [CommentsLinks.randomMethod2] don't need full name prefix, but it's
/// possible to references other interfaces like [CommentsInterface] or other members
/// [someMethodWithAllComments].
/// [Comments.someMethodWithAllComments].
///
/// Weblinks are not modified like this [example1], [example2](http://www.example.com/2) or <https://www.example.com/3>.
///
Expand All @@ -25,11 +25,11 @@ abstract class CommentsLinks {
/// * enum: [Comments_SomeEnum]
/// * enum item: [Comments_SomeEnum.useful]
/// * property: [Comments.isSomeProperty]
/// * property setter: [isSomeProperty]
/// * property getter: [isSomeProperty]
/// * method: [someMethodWithAllComments]
/// * method with signature: [oneParameterCommentOnly]
/// * method with signature with no spaces: [oneParameterCommentOnly]
/// * property setter: [Comments.isSomeProperty]
/// * property getter: [Comments.isSomeProperty]
/// * method: [Comments.someMethodWithAllComments]
/// * method with signature: [Comments.oneParameterCommentOnly]
/// * method with signature with no spaces: [Comments.oneParameterCommentOnly]
/// * parameter: [CommentsLinks.randomMethod.inputParameter]
/// * top level constant: [CommentsTypeCollection.typeCollectionConstant]
/// * top level struct: [TypeCollectionStruct]
Expand All @@ -54,9 +54,9 @@ abstract class CommentsLinks {
/// Throws [Comments_SomethingWrongException]. May or may not throw [Comments_SomethingWrongException]
Comments_SomeEnum randomMethod(Comments_SomeEnum inputParameter);
/// Links to method overloads:
/// * other one: [randomMethod]
/// * this one: [randomMethod2]
/// * ambiguous one: [randomMethod2]
/// * other one: [CommentsLinks.randomMethod]
/// * this one: [CommentsLinks.randomMethod2]
/// * ambiguous one: [CommentsLinks.randomMethod2]
randomMethod2(String text, bool flag);
}
/// Links also work in:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ abstract class DeprecationComments {
/// This is some very useful method that measures the usefulness of its input.
/// [input] Very useful input parameter
/// Returns [bool]. Usefulness of the input
@Deprecated("Unfortunately, this method is deprecated.\nUse [someMethodWithAllComments] instead.")
@Deprecated("Unfortunately, this method is deprecated.\nUse [Comments.someMethodWithAllComments] instead.")
bool someMethodWithAllComments(String input);
/// Gets some very useful property.
@Deprecated("Unfortunately, this property's getter is deprecated.\nUse [isSomeProperty] instead.")
@Deprecated("Unfortunately, this property's getter is deprecated.\nUse [Comments.isSomeProperty] instead.")
bool get isSomeProperty;
/// Sets some very useful property.
@Deprecated("Unfortunately, this property's setter is deprecated.\nUse [isSomeProperty] instead.")
@Deprecated("Unfortunately, this property's setter is deprecated.\nUse [Comments.isSomeProperty] instead.")
set isSomeProperty(bool value);
}
/// This is some very useful enum.
Expand Down Expand Up @@ -236,7 +236,7 @@ class DeprecationComments$Impl implements DeprecationComments {
}
}
/// Gets some very useful property.
@Deprecated("Unfortunately, this property's getter is deprecated.\nUse [isSomeProperty] instead.")
@Deprecated("Unfortunately, this property's getter is deprecated.\nUse [Comments.isSomeProperty] instead.")
bool get isSomeProperty {
final _get_ffi = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<Uint8 Function(Pointer<Void>, Int32), int Function(Pointer<Void>, int)>('library_smoke_DeprecationComments_isSomeProperty_get'));
final _handle = this.handle;
Expand All @@ -248,7 +248,7 @@ class DeprecationComments$Impl implements DeprecationComments {
}
}
/// Sets some very useful property.
@Deprecated("Unfortunately, this property's setter is deprecated.\nUse [isSomeProperty] instead.")
@Deprecated("Unfortunately, this property's setter is deprecated.\nUse [Comments.isSomeProperty] instead.")
set isSomeProperty(bool value) {
final _set_ffi = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<Void Function(Pointer<Void>, Int32, Uint8), void Function(Pointer<Void>, int, int)>('library_smoke_DeprecationComments_isSomeProperty_set__Boolean'));
final _value_handle = Boolean_toFfi(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CommentsLinks {
// * struct: [comments.SomeStruct]
// * struct field: [comments.SomeStruct.someField]
// * enum: [comments.SomeEnum]
// * enum item: [comments.SomeEnum.Useful]
// * enum item: [comments.SomeEnum.USEFUL]
// * property: [comments.SomeProperty]
// * property setter: [comments.SomeProperty.set]
// * property getter: [comments.SomeProperty.get]
Expand All @@ -47,8 +47,8 @@ class CommentsLinks {
//
// Not working for Swift:
// * named comment: [Alternative name for the link, stripped for Swift][comments.VeryUseful]
// @param[inputParameter] Sometimes takes [comments.SomeEnum.Useful]
// @return Sometimes returns [comments.SomeEnum.Useful]
// @param[inputParameter] Sometimes takes [comments.SomeEnum.USEFUL]
// @return Sometimes returns [comments.SomeEnum.USEFUL]
// @throws May or may not throw [comments.SomethingWrong]
fun random_method(
inputParameter: SomeEnum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class comments {
// Not quite useful
Useless,
// Somewhat useful
Useful
USEFUL
}
// This is some very useful exception.
exception SomethingWrong(SomeEnum)
Expand Down