@@ -260,10 +260,9 @@ class PubPackageBuilder implements PackageBuilder {
260
260
261
261
current = _packageMetasForFiles (files.difference (_knownParts));
262
262
// To get canonicalization correct for non-locally documented packages
263
- // (so we can generate the right hyperlinks), it's vital that we
264
- // add all libraries in dependent packages. So if the analyzer
265
- // discovers some files in a package we haven't seen yet, add files
266
- // for that package.
263
+ // (so we can generate the right hyperlinks), it's vital that we add all
264
+ // libraries in dependent packages. So if the analyzer discovers some
265
+ // files in a package we haven't seen yet, add files for that package.
267
266
for (var meta in current.difference (lastPass)) {
268
267
if (meta.isSdk) {
269
268
if (! _skipUnreachableSdkLibraries) {
@@ -337,9 +336,10 @@ class PubPackageBuilder implements PackageBuilder {
337
336
338
337
/// Lists the contents of [dir] .
339
338
///
340
- /// If [recursive] is `true` , lists subdirectory contents (defaults to `false` ).
339
+ /// If [recursive] is `true` , lists subdirectory contents (defaults to
340
+ /// `false` ).
341
341
///
342
- /// Excludes files and directories beginning with `.`
342
+ /// Excludes files and directories beginning with `.` .
343
343
///
344
344
/// The returned paths are guaranteed to begin with [dir] .
345
345
Iterable <String > _listDir (String dir,
@@ -419,13 +419,11 @@ class PubPackageBuilder implements PackageBuilder {
419
419
}
420
420
421
421
Future <void > getLibraries (PackageGraph uninitializedPackageGraph) async {
422
- DartSdk findSpecialsSdk;
423
422
var embedderSdk = this .embedderSdk;
424
- if (embedderSdk != null && embedderSdk.urlMappings.isNotEmpty) {
425
- findSpecialsSdk = embedderSdk;
426
- } else {
427
- findSpecialsSdk = sdk;
428
- }
423
+ var findSpecialsSdk = switch (embedderSdk) {
424
+ EmbedderSdk (: var urlMappings) when urlMappings.isNotEmpty => embedderSdk,
425
+ _ => sdk,
426
+ };
429
427
var files = await _getFiles ();
430
428
var specialFiles = specialLibraryFiles (findSpecialsSdk);
431
429
@@ -499,16 +497,7 @@ class DartDocResolvedLibrary {
499
497
if (fullName != null && ! element.isSynthetic && element.nameOffset != - 1 ) {
500
498
var unit = _units[fullName];
501
499
if (unit != null ) {
502
- var locator = NodeLocator2 (element.nameOffset);
503
- var node = locator.searchWithin (unit);
504
- if (node is SimpleIdentifier ) {
505
- // TODO(scheglov) Remove this branch after the breaking change for
506
- // the analyzer, when we start returning the declaring node, not
507
- // the name, which will be just a `Token`.
508
- return node.parent;
509
- } else {
510
- return node;
511
- }
500
+ return NodeLocator2 (element.nameOffset).searchWithin (unit);
512
501
}
513
502
}
514
503
return null ;
0 commit comments