Skip to content

Commit e01eab3

Browse files
authored
Remove missingConstantConstructor warning. (#3674)
1 parent 5a1700f commit e01eab3

File tree

3 files changed

+1
-21
lines changed

3 files changed

+1
-21
lines changed

lib/src/model/getter_setter_combo.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import 'package:dartdoc/src/model/attribute.dart';
1717
import 'package:dartdoc/src/model/comment_referable.dart';
1818
import 'package:dartdoc/src/model/model.dart';
1919
import 'package:dartdoc/src/utils.dart';
20-
import 'package:dartdoc/src/warnings.dart';
2120
import 'package:meta/meta.dart';
2221

2322
/// Mixin for top-level variables and fields (aka properties).
@@ -68,10 +67,7 @@ mixin GetterSetterCombo on ModelElement {
6867
var creationExpression = constantInitializer as InstanceCreationExpression;
6968
var constructorName = creationExpression.constructorName.toString();
7069
Element? staticElement = creationExpression.constructorName.staticElement;
71-
if (staticElement == null) {
72-
warn(PackageWarning.missingConstantConstructor, message: constructorName);
73-
return original;
74-
}
70+
if (staticElement == null) return original;
7571
var target = getModelForElement(staticElement) as Constructor;
7672
var enclosingElement = target.enclosingElement;
7773
if (enclosingElement is! Class) return original;

lib/src/model/package_graph.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ class PackageGraph with CommentReferable, Nameable {
455455
PackageWarning.toolError ||
456456
PackageWarning.deprecated ||
457457
PackageWarning.unresolvedExport ||
458-
PackageWarning.missingConstantConstructor ||
459458
PackageWarning.missingExampleFile ||
460459
PackageWarning.missingCodeBlockLanguage =>
461460
kind.messageFor([message])

lib/src/warnings.dart

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,6 @@ enum PackageWarning implements Comparable<PackageWarning> {
285285
shortHelp: 'An export refers to a URI that cannot be resolved.',
286286
defaultWarningMode: PackageWarningMode.error,
287287
),
288-
missingConstantConstructor(
289-
'missing-constant-constructor',
290-
'constant constructor missing: {0}',
291-
shortHelp:
292-
'Dartdoc can not show the value of a constant because its constructor '
293-
'could not be resolved.',
294-
longHelp:
295-
'To resolve a constant into its literal value, Dartdoc relies on the '
296-
"analyzer to resolve the constructor. The analyzer didn't provide the "
297-
"constructor for '$_namePlaceholder', which is usually due to an error "
298-
'in the code. Use the analyzer to resolve the issue.',
299-
// Defaults to ignore as this doesn't impact the docs severely but is
300-
// useful for debugging package structure.
301-
defaultWarningMode: PackageWarningMode.ignore,
302-
),
303288
missingExampleFile(
304289
'missing-example-file',
305290
'example file not found: {0}',

0 commit comments

Comments
 (0)