Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

Unified Diff: lib/src/validator/dependency.dart

Issue 2184303002: Make pub strong-mode clean. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/validator.dart ('k') | lib/src/validator/sdk_constraint.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/validator/dependency.dart
diff --git a/lib/src/validator/dependency.dart b/lib/src/validator/dependency.dart
index a4fdf636f0d202ab1be24758947d38f6990128e6..38451ef433c7853367821629d34de4daa600889f 100644
--- a/lib/src/validator/dependency.dart
+++ b/lib/src/validator/dependency.dart
@@ -36,23 +36,24 @@ class DependencyValidator extends Validator {
: super(entrypoint);
Future validate() async {
- var caretDeps = [];
+ var caretDeps = <PackageDep>[];
for (var dependency in entrypoint.root.pubspec.dependencies) {
+ var constraint = dependency.constraint;
if (dependency.source is! HostedSource) {
await _warnAboutSource(dependency);
- } else if (dependency.constraint.isAny) {
+ } else if (constraint.isAny) {
_warnAboutNoConstraint(dependency);
- } else if (dependency.constraint is Version) {
+ } else if (constraint is Version) {
_warnAboutSingleVersionConstraint(dependency);
- } else if (dependency.constraint is VersionRange) {
- if (dependency.constraint.min == null) {
+ } else if (constraint is VersionRange) {
+ if (constraint.min == null) {
_warnAboutNoConstraintLowerBound(dependency);
- } else if (dependency.constraint.max == null) {
+ } else if (constraint.max == null) {
_warnAboutNoConstraintUpperBound(dependency);
}
- if (dependency.constraint.toString().startsWith("^")) {
+ if (constraint.toString().startsWith("^")) {
caretDeps.add(dependency);
}
}
@@ -65,7 +66,7 @@ class DependencyValidator extends Validator {
/// Warn that dependencies should use the hosted source.
Future _warnAboutSource(PackageDep dep) async {
- var versions;
+ List<Version> versions;
try {
var ids = await entrypoint.cache.hosted
.getVersions(entrypoint.cache.sources.hosted.refFor(dep.name));
« no previous file with comments | « lib/src/validator.dart ('k') | lib/src/validator/sdk_constraint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698