Skip to content

HtmlGeneratorInstance: remove getter indirection for writtenFiles #1530

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

Merged
merged 1 commit into from
Nov 3, 2017
Merged
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
9 changes: 4 additions & 5 deletions lib/src/html/html_generator_instance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ class HtmlGeneratorInstance implements HtmlOptions {
String get faviconPath => _options.faviconPath;
bool get useCategories => _options.useCategories;
bool get prettyIndexJson => _options.prettyIndexJson;

// Protect against bugs in canonicalization by tracking what files we
// write.
final Set<String> _writtenFiles = new Set();
final Set<String> writtenFiles = new Set<String>();

HtmlGeneratorInstance(this._options, this._templates, this.package, this.out,
this._onFileCreated);
Expand Down Expand Up @@ -297,8 +298,6 @@ class HtmlGeneratorInstance implements HtmlOptions {
}
}

Set<String> get writtenFiles => _writtenFiles;

void _build(String filename, TemplateRenderer template, TemplateData data) {
String fullName = path.join(out.path, filename);

Expand All @@ -307,9 +306,9 @@ class HtmlGeneratorInstance implements HtmlOptions {

// If you see this assert, we're probably being called to build non-canonical
// docs somehow. Check data.self.isCanonical and callers for bugs.
assert(!_writtenFiles.contains(fullName));
assert(!writtenFiles.contains(fullName));
_writeFile(fullName, content);
_writtenFiles.add(fullName);
writtenFiles.add(fullName);
if (data.self is ModelElement) documentedElements.add(data.self);
}

Expand Down