mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:59:38 +00:00
add newline after doc comments, add tests for doc comments
Bug: https://github.com/dart-lang/sdk/issues/55128 Change-Id: I6897e33ad291093d460e28a0b0f374d6504418e5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356260 Auto-Submit: Jake Macdonald <jakemac@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
0f1adddec3
commit
f2e8464b98
|
@ -574,7 +574,7 @@ DeclarationCode _buildFunctionAugmentation(
|
|||
assert(initializers == null || declaration is ConstructorDeclaration);
|
||||
|
||||
return new DeclarationCode.fromParts([
|
||||
if (docComments != null) docComments,
|
||||
if (docComments != null) ...[docComments, '\n'],
|
||||
if (declaration is MethodDeclaration) ' ',
|
||||
'augment ',
|
||||
if (declaration is ConstructorDeclaration) ...[
|
||||
|
|
|
@ -676,6 +676,7 @@ class LibraryInfo {
|
|||
expect(
|
||||
result.libraryAugmentations.single.debugString().toString(),
|
||||
equalsIgnoringWhitespace('''
|
||||
// A comment!
|
||||
augment String myFunction() {
|
||||
print('isExternal: false');
|
||||
print('isGetter: false');
|
||||
|
@ -733,6 +734,7 @@ class LibraryInfo {
|
|||
expect(
|
||||
result.libraryAugmentations.single.debugString().toString(),
|
||||
equalsIgnoringWhitespace('''
|
||||
// A comment!
|
||||
augment String get myVariable {
|
||||
print('isExternal: false');
|
||||
print('isGetter: true');
|
||||
|
@ -754,6 +756,7 @@ class LibraryInfo {
|
|||
expect(
|
||||
result.libraryAugmentations.single.debugString().toString(),
|
||||
equalsIgnoringWhitespace('''
|
||||
// A comment!
|
||||
augment void set myVariable(String value, ) {
|
||||
print('isExternal: false');
|
||||
print('isGetter: false');
|
||||
|
@ -1020,6 +1023,7 @@ final fieldDefinitionMatchers = [
|
|||
|
||||
final methodDefinitionMatchers = [
|
||||
equalsIgnoringWhitespace('''
|
||||
// A comment!
|
||||
augment (String, bool? hello, {String world}) myMethod() {
|
||||
print('definingClass: MyClass');
|
||||
print('isExternal: false');
|
||||
|
@ -1050,6 +1054,7 @@ final methodDefinitionMatchers = [
|
|||
|
||||
final mixinMethodDefinitionMatchers = [
|
||||
equalsIgnoringWhitespace('''
|
||||
// A comment!
|
||||
augment (String, bool? hello, {String world}) myMixinMethod() {
|
||||
print('definingClass: MyMixin');
|
||||
print('isExternal: false');
|
||||
|
|
|
@ -323,7 +323,8 @@ class SimpleMacro
|
|||
@override
|
||||
Future<void> buildDefinitionForFunction(
|
||||
FunctionDeclaration function, FunctionDefinitionBuilder builder) async {
|
||||
builder.augment(await _buildFunctionAugmentation(function, builder));
|
||||
builder.augment(await _buildFunctionAugmentation(function, builder),
|
||||
docComments: CommentCode.fromString('// A comment!'));
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
Loading…
Reference in a new issue