Skip to content

Commit 2a81b64

Browse files
authored
Fix infinite recursion in reexport tagger (#1838)
* Fix infinite recursion in reexport tagger * add shelf_exception_handler to bots * Reduce analyzer requirement to keep us in the 2.0 SDK window
1 parent 47dba01 commit 2a81b64

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

lib/src/model.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5037,9 +5037,16 @@ class PackageGraph {
50375037
packages.where((p) => p.documentedWhere != DocumentLocation.missing);
50385038

50395039
Map<LibraryElement, Set<Library>> _libraryElementReexportedBy = new Map();
5040+
/// Prevent cycles from breaking our stack.
5041+
Set<Tuple2<Library, LibraryElement>> _reexportsTagged = new Set();
50405042
void _tagReexportsFor(
50415043
final Library topLevelLibrary, final LibraryElement libraryElement,
50425044
[ExportElement lastExportedElement]) {
5045+
Tuple2<Library, LibraryElement> key = new Tuple2(topLevelLibrary, libraryElement);
5046+
if (_reexportsTagged.contains(key)) {
5047+
return;
5048+
}
5049+
_reexportsTagged.add(key);
50435050
if (libraryElement == null) {
50445051
// The first call to _tagReexportFor should not have a null libraryElement.
50455052
assert(lastExportedElement != null);
@@ -5064,6 +5071,7 @@ class PackageGraph {
50645071
if (allLibraries.keys.length != _lastSizeOfAllLibraries) {
50655072
_lastSizeOfAllLibraries = allLibraries.keys.length;
50665073
_libraryElementReexportedBy = new Map<LibraryElement, Set<Library>>();
5074+
_reexportsTagged = new Set();
50675075
for (Library library in publicLibraries) {
50685076
_tagReexportsFor(library, library.element);
50695077
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ environment:
88
sdk: '>=2.0.0 <3.0.0'
99

1010
dependencies:
11-
analyzer: ^0.33.1
11+
analyzer: ^0.33.3+1
1212
args: '>=1.4.1 <2.0.0'
1313
collection: ^1.2.0
1414
crypto: ^2.0.6

testing/test_package/lib/fake.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ import 'two_exports.dart' show BaseClass;
5757
export 'package:test_package_imported/categoryExporting.dart'
5858
show IAmAClassWithCategories;
5959

60+
// Explicitly export ourselves, because why not.
61+
// ignore: uri_does_not_exist
62+
export 'package:test_package/fake.dart';
63+
6064
abstract class ImplementingThingy implements BaseThingy {}
6165

6266
abstract class BaseThingy {

tool/travis.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ elif [ "$DARTDOC_BOT" = "packages" ]; then
2828
else
2929
PACKAGE_NAME=angular PACKAGE_VERSION=">=5.0.0-beta <5.1.0" DARTDOC_PARAMS="--include=angular,angular.security" pub run grinder build-pub-package
3030
fi
31+
PACKAGE_NAME=shelf_exception_handler PACKAGE_VERSION=">=0.2.0" pub run grinder build-pub-package
3132
elif [ "$DARTDOC_BOT" = "sdk-analyzer" ]; then
3233
echo "Running main dartdoc bot against the SDK analyzer"
3334
DARTDOC_GRIND_STEP=buildbot-no-publish pub run grinder test-with-analyzer-sdk

0 commit comments

Comments
 (0)