Index: utils/pub/pubspec.dart |
diff --git a/utils/pub/pubspec.dart b/utils/pub/pubspec.dart |
index fac89ebb8b774ab24d66857c7920eb32a33826f8..779a29490dde802ead5d07764cc71451c645ca62 100644 |
--- a/utils/pub/pubspec.dart |
+++ b/utils/pub/pubspec.dart |
@@ -38,8 +38,7 @@ class Pubspec { |
if (!fileExists(pubspecPath)) throw new PubspecNotFoundException(name); |
try { |
- var pubspec = new Pubspec.parse(pubspecPath, readTextFile(pubspecPath), |
- sources); |
+ var pubspec = new Pubspec.parse(readTextFile(pubspecPath), sources); |
if (pubspec.name == null) { |
throw new PubspecHasNoNameException(name); |
@@ -70,12 +69,10 @@ class Pubspec { |
bool get isEmpty => |
name == null && version == Version.none && dependencies.isEmpty; |
- /// Parses the pubspec stored at [filePath] whose text is [contents]. If the |
- /// pubspec doesn't define version for itself, it defaults to [Version.none]. |
- /// [filePath] may be `null` if the pubspec is not on the user's local |
- /// file system. |
- factory Pubspec.parse(String filePath, String contents, |
- SourceRegistry sources) { |
+ // TODO(rnystrom): Make this a static method to match corelib. |
+ /// Parses the pubspec whose text is [contents]. If the pubspec doesn't define |
+ /// version for itself, it defaults to [Version.none]. |
+ factory Pubspec.parse(String contents, SourceRegistry sources) { |
var name = null; |
var version = Version.none; |
@@ -100,7 +97,7 @@ class Pubspec { |
version = new Version.parse(parsedPubspec['version']); |
} |
- var dependencies = _parseDependencies(filePath, sources, |
+ var dependencies = _parseDependencies(sources, |
parsedPubspec['dependencies']); |
var environmentYaml = parsedPubspec['environment']; |
@@ -190,8 +187,7 @@ void _validateFieldUrl(url, String field) { |
} |
} |
-List<PackageRef> _parseDependencies(String pubspecPath, SourceRegistry sources, |
- yaml) { |
+List<PackageRef> _parseDependencies(SourceRegistry sources, yaml) { |
var dependencies = <PackageRef>[]; |
// Allow an empty dependencies key. |
@@ -237,8 +233,7 @@ List<PackageRef> _parseDependencies(String pubspecPath, SourceRegistry sources, |
'Dependency specification $spec should be a string or a mapping.'); |
} |
- description = source.parseDescription(pubspecPath, description, |
- fromLockFile: false); |
+ source.validateDescription(description, fromLockFile: false); |
dependencies.add(new PackageRef( |
name, source, versionConstraint, description)); |