Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stack overflows on complex packages #1383

Merged
merged 3 commits into from
Apr 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* added a new `--footer-text` command-line option, to allow adding additional
text in the package name and copyright section of the footer
* Reduced stack depth by not recomputing findCanonicalLibraryFor (#1381)

## 0.10.0

Expand Down
4 changes: 2 additions & 2 deletions dartdoc.iml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/bin" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
Expand Down Expand Up @@ -33,7 +33,7 @@
<excludeFolder url="file://$MODULE_DIR$/tool/packages" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart Packages" level="project" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart SDK" level="application" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diff likely means that you need to update your IntelliJ to 2017.1 :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you'll likely see an update here early next week.

</component>
</module>
3 changes: 2 additions & 1 deletion lib/src/html/html_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class HtmlGenerator extends Generator {
static Future<HtmlGenerator> create(
{HtmlGeneratorOptions options,
List<String> headers,
List<String> footers, List<String> footerTexts}) async {
List<String> footers,
List<String> footerTexts}) async {
var templates = await Templates.create(
headerPaths: headers,
footerPaths: footers,
Expand Down
13 changes: 11 additions & 2 deletions lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2796,16 +2796,25 @@ class Package implements Nameable, Documentable {
@override
String toString() => isSdk ? 'SDK' : 'Package $name';

final Map<Element, Library> _canonicalLibraryFor = new Map();

/// Tries to find a top level library that references this element.
Library findCanonicalLibraryFor(Element e) {
assert(allLibrariesAdded);

if (_canonicalLibraryFor.containsKey(e)) {
return _canonicalLibraryFor[e];
}
_canonicalLibraryFor[e] = null;
for (Library library in libraries) {
if (library.modelElementsMap.containsKey(e)) {
if (library.modelElementsMap[e].isCanonical) {
return library;
_canonicalLibraryFor[e] = library;
break;
}
}
}
return null;
return _canonicalLibraryFor[e];
}

/// Tries to find a canonical ModelElement for this element.
Expand Down