Index: sdk/lib/_internal/pub/lib/src/lock_file.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/lock_file.dart b/sdk/lib/_internal/pub/lib/src/lock_file.dart |
index 9dacba2e93e73bec542e425d0dbab14c6a22ec33..128a3a9c5a3a505c4af04149a93b9c93f5ff64a4 100644 |
--- a/sdk/lib/_internal/pub/lib/src/lock_file.dart |
+++ b/sdk/lib/_internal/pub/lib/src/lock_file.dart |
@@ -45,13 +45,18 @@ class LockFile { |
} |
/// Parses the lockfile whose text is [contents]. |
+ /// |
+ /// [filePath] is the system-native path to the lockfile on disc. It may be |
+ /// `null`. |
static LockFile _parse(String filePath, String contents, |
SourceRegistry sources) { |
var packages = <String, PackageId>{}; |
if (contents.trim() == '') return new LockFile.empty(); |
- var parsed = loadYamlNode(contents, |
- sourceName: p.toUri(filePath).toString()); |
+ |
+ var sourceName; |
+ if (filePath != null) sourceName = p.toUri(filePath).toString(); |
+ var parsed = loadYamlNode(contents, sourceName: sourceName); |
_validate(parsed is Map, 'The lockfile must be a YAML mapping.', parsed); |