Shorthand syntax for hosted dependencies (#3133)

If you have language-version 2.15 or higher you can specify hosted dependencies like:
```
dependencies:
  foo:
    hosted: <url>
  bar: # alternatively
    hosted:
      url: <url>
```
Before you had to write:

```
  dependencies:
    foo:
       hosted:
          name: foo
          url: <url>
```
diff --git a/lib/src/pubspec.dart b/lib/src/pubspec.dart
index b700638..cc75b2d 100644
--- a/lib/src/pubspec.dart
+++ b/lib/src/pubspec.dart
@@ -441,10 +441,8 @@
       VersionConstraint versionConstraint = VersionRange();
       var features = const <String, FeatureDependency>{};
       if (spec == null) {
-        descriptionNode = nameNode;
         sourceName = _sources!.defaultSource.name;
       } else if (spec is String) {
-        descriptionNode = nameNode;
         sourceName = _sources!.defaultSource.name;
         versionConstraint = _parseVersionConstraint(specNode);
       } else if (spec is Map) {
@@ -468,7 +466,6 @@
         } else if (sourceNames.isEmpty) {
           // Default to a hosted dependency if no source is specified.
           sourceName = 'hosted';
-          descriptionNode = nameNode;
         }
 
         sourceName ??= sourceNames.single;
@@ -491,8 +488,12 @@
           pubspecPath = path.fromUri(_location);
         }
 
-        return _sources![sourceName]!.parseRef(name, descriptionNode?.value,
-            containingPath: pubspecPath);
+        return _sources![sourceName]!.parseRef(
+          name,
+          descriptionNode?.value,
+          containingPath: pubspecPath,
+          languageVersion: languageVersion,
+        );
       }, targetPackage: name);
 
       dependencies[name] =
@@ -611,6 +612,9 @@
     try {
       return fn();
     } on FormatException catch (e) {
+      // If we already have a pub exception with a span, re-use that
+      if (e is PubspecException) rethrow;
+
       var msg = 'Invalid $description';
       if (targetPackage != null) {
         msg = '$msg in the "$name" pubspec on the "$targetPackage" dependency';