@@ -446,15 +446,22 @@ class _MarkdownCommentReference {
446
446
// If a result is accessible in this library, prefer that.
447
447
_reducePreferResultsAccessibleInSameLibrary,
448
448
// This may refer to an element with the same name in multiple libraries
449
- // in an external package, e.g. Matrix4 in vector_math and vector_math_64.
450
- // Disambiguate by attempting to figure out which of them our package
451
- // is actually using by checking the import/export graph.
449
+ // in an external package, e.g. Matrix4 in vector_math and
450
+ // vector_math_64. Disambiguate by attempting to figure out which of
451
+ // them our package is actually using by checking the import/export
452
+ // graph.
452
453
_reducePreferLibrariesInLocalImportExportGraph,
453
- // If a result's fully qualified name has pieces of the comment reference,
454
- // prefer that.
454
+ // If a result's fully qualified name has pieces of the comment
455
+ // reference, prefer that.
455
456
_reducePreferReferencesIncludingFullyQualifiedName,
456
- // Prefer the Dart analyzer's resolution of comment references. We can't
457
- // start from this because of the differences in Dartdoc canonicalization.
457
+ // If the reference is indicated to be a constructor, prefer
458
+ // constructors. This is not as generic as it sounds; very few naming
459
+ // conflicts are allowed, but an instance field is allowed to have the
460
+ // same name as a named constructor.
461
+ _reducePreferConstructorViaIndicators,
462
+ // Prefer the Dart analyzer's resolution of comment references. We
463
+ // can't start from this because of the differences in Dartdoc
464
+ // canonicalization.
458
465
_reducePreferAnalyzerResolution,
459
466
]) {
460
467
reduceMethod ();
@@ -497,6 +504,13 @@ class _MarkdownCommentReference {
497
504
}
498
505
}
499
506
507
+ void _reducePreferConstructorViaIndicators () {
508
+ if (codeRef.contains (_constructorIndicationPattern) &&
509
+ codeRefChompedParts.length >= 2 ) {
510
+ results.removeWhere ((r) => r is ! Constructor );
511
+ }
512
+ }
513
+
500
514
void _reducePreferReferencesIncludingFullyQualifiedName () {
501
515
var startName = '${element .fullyQualifiedName }.' ;
502
516
var realName = '${element .fullyQualifiedName }.${codeRefChomped }' ;
0 commit comments