From f34551dbc3500cdfb80cfdc0335e2aa06f1e104e Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Tue, 30 Apr 2024 15:48:25 -0700 Subject: [PATCH] Stop supporting '[this]' as a comment reference. The analyzer does not support it and does not intend to, so this change aligns with that effort. It makes analyzing the gap between analyzer and dartdoc easier as well. Fixes https://github.com/dart-lang/dartdoc/issues/3761 --- CHANGELOG.md | 3 +++ lib/src/dartdoc_options.dart | 2 +- lib/src/model/container.dart | 1 - test/end2end/model_test.dart | 3 --- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71df667392..927424545f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ ## 8.0.10-dev * Un-deprecate the `--resources-dir` option. +* Remove support for `[this]` as a comment reference. Referring to the + containing element can be written as `this [Foo]`, and referring to 'this' + can just be written as `` `this` ``. ## 8.0.9 diff --git a/lib/src/dartdoc_options.dart b/lib/src/dartdoc_options.dart index 237944cbc0..a529ba6b71 100644 --- a/lib/src/dartdoc_options.dart +++ b/lib/src/dartdoc_options.dart @@ -572,7 +572,7 @@ abstract class DartdocOption { U getValueAs(String name, Folder dir) => _children[name]?.valueAt(dir) as U; - /// Apply the function [visit] to [this] and all children. + /// Apply the function [visit] to this [DartdocOption] and all children. void traverse(void Function(DartdocOption option) visit) { visit(this); for (var value in _children.values) { diff --git a/lib/src/model/container.dart b/lib/src/model/container.dart index e4bd324ba6..88def839d6 100644 --- a/lib/src/model/container.dart +++ b/lib/src/model/container.dart @@ -242,7 +242,6 @@ abstract class Container extends ModelElement .addEntriesIfAbsent(modelElement.parameters.generateEntries()); } } - referenceChildren['this'] = this; return referenceChildren; }(); diff --git a/test/end2end/model_test.dart b/test/end2end/model_test.dart index bd4e326290..62d2882c54 100644 --- a/test/end2end/model_test.dart +++ b/test/end2end/model_test.dart @@ -2742,9 +2742,6 @@ void main() async { doAwesomeStuff, 'BaseForDocComments.aNonDefaultConstructor'), equals(MatchingLinkResult(aNonDefaultConstructor))); - expect(referenceLookup(doAwesomeStuff, 'this'), - equals(MatchingLinkResult(baseForDocComments))); - expect(referenceLookup(doAwesomeStuff, 'value'), equals(MatchingLinkResult(doAwesomeStuffParam)));