[private-named-parameters] Dartdoc Support
This issue tracks the work needed to support "Private Named Parameters" in Dartdoc.
This feature does impact Dartdoc in that we want a private named parameter to be documented as its public name. Given a class like:
class C {
int _x;
C({required this._x});
}
Then the dartdoc for the constructor should look something like:
C({required int x});
Also, all visible textual references to the parameter in the actual generated DartDoc should use the public name, so
class Baz {
final int foo, _bar;
/// Creates `Baz` from [foo] and [_bar].
new(this.foo, {this._bar}) : asset(_bar != 0);
}
will generate a documentation of:
Creates <code>Baz</code> from
<code>foo</code> and <code>bar</code>.
(It would be nice if DartDoc did the same thing for positional private initializing or declaring parameters, otherwise I'll still have to do (int foo): _foo = foo;. That needs to check if there is another parameter which has the corresponding make already, but otherwise it would be the same.)
@johnniwinther this sounds like the analyzer api should provide a "external name" of parameters somehow?
Yes. To the extent that we use AST nodes for printing the constructor parameters we need this. The element should show the public name in all cases.