Skip to content

Commit

Permalink
Remove missingConstantConstructor warning. (#3674)
Browse files Browse the repository at this point in the history
  • Loading branch information
kallentu authored Feb 23, 2024
1 parent 5a1700f commit e01eab3
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
6 changes: 1 addition & 5 deletions lib/src/model/getter_setter_combo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import 'package:dartdoc/src/model/attribute.dart';
import 'package:dartdoc/src/model/comment_referable.dart';
import 'package:dartdoc/src/model/model.dart';
import 'package:dartdoc/src/utils.dart';
import 'package:dartdoc/src/warnings.dart';
import 'package:meta/meta.dart';

/// Mixin for top-level variables and fields (aka properties).
Expand Down Expand Up @@ -68,10 +67,7 @@ mixin GetterSetterCombo on ModelElement {
var creationExpression = constantInitializer as InstanceCreationExpression;
var constructorName = creationExpression.constructorName.toString();
Element? staticElement = creationExpression.constructorName.staticElement;
if (staticElement == null) {
warn(PackageWarning.missingConstantConstructor, message: constructorName);
return original;
}
if (staticElement == null) return original;
var target = getModelForElement(staticElement) as Constructor;
var enclosingElement = target.enclosingElement;
if (enclosingElement is! Class) return original;
Expand Down
1 change: 0 additions & 1 deletion lib/src/model/package_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ class PackageGraph with CommentReferable, Nameable {
PackageWarning.toolError ||
PackageWarning.deprecated ||
PackageWarning.unresolvedExport ||
PackageWarning.missingConstantConstructor ||
PackageWarning.missingExampleFile ||
PackageWarning.missingCodeBlockLanguage =>
kind.messageFor([message])
Expand Down
15 changes: 0 additions & 15 deletions lib/src/warnings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,21 +285,6 @@ enum PackageWarning implements Comparable<PackageWarning> {
shortHelp: 'An export refers to a URI that cannot be resolved.',
defaultWarningMode: PackageWarningMode.error,
),
missingConstantConstructor(
'missing-constant-constructor',
'constant constructor missing: {0}',
shortHelp:
'Dartdoc can not show the value of a constant because its constructor '
'could not be resolved.',
longHelp:
'To resolve a constant into its literal value, Dartdoc relies on the '
"analyzer to resolve the constructor. The analyzer didn't provide the "
"constructor for '$_namePlaceholder', which is usually due to an error "
'in the code. Use the analyzer to resolve the issue.',
// Defaults to ignore as this doesn't impact the docs severely but is
// useful for debugging package structure.
defaultWarningMode: PackageWarningMode.ignore,
),
missingExampleFile(
'missing-example-file',
'example file not found: {0}',
Expand Down

0 comments on commit e01eab3

Please sign in to comment.