Index: sdk/lib/_internal/pub/lib/src/pubspec.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/pubspec.dart b/sdk/lib/_internal/pub/lib/src/pubspec.dart |
index 6da96ba621cc6f2456a9a5bc41e00cc99bd0ac71..049857754de00f3999f1e7e5cf8e6b19e4ab9e6a 100644 |
--- a/sdk/lib/_internal/pub/lib/src/pubspec.dart |
+++ b/sdk/lib/_internal/pub/lib/src/pubspec.dart |
@@ -135,10 +135,10 @@ Pubspec _parseMap(String filePath, Map map, SourceRegistry sources) { |
version = new Version.parse(map['version']); |
} |
- var dependencies = _parseDependencies(filePath, sources, |
+ var dependencies = _parseDependencies(name, filePath, sources, |
map['dependencies']); |
- var devDependencies = _parseDependencies(filePath, sources, |
+ var devDependencies = _parseDependencies(name, filePath, sources, |
map['dev_dependencies']); |
// Make sure the same package doesn't appear as both a regular and dev |
@@ -241,8 +241,8 @@ Pubspec _parseMap(String filePath, Map map, SourceRegistry sources) { |
environment, map); |
} |
-List<PackageDep> _parseDependencies(String pubspecPath, SourceRegistry sources, |
- yaml) { |
+List<PackageDep> _parseDependencies(String packageName, String pubspecPath, |
+ SourceRegistry sources, yaml) { |
var dependencies = <PackageDep>[]; |
// Allow an empty dependencies key. |
@@ -255,6 +255,10 @@ List<PackageDep> _parseDependencies(String pubspecPath, SourceRegistry sources, |
} |
yaml.forEach((name, spec) { |
+ if (name == packageName) { |
+ throw new FormatException("Package '$name' cannot depend on itself."); |
nweiz
2013/08/22 00:18:21
Rather than specifically including the package nam
Bob Nystrom
2013/08/22 18:09:30
When one of these exceptions is thrown, the output
|
+ } |
+ |
var description; |
var sourceName; |