Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Rework how we handle laziness. #543

Merged
merged 9 commits into from
Apr 4, 2017
Merged

Rework how we handle laziness. #543

merged 9 commits into from
Apr 4, 2017

Conversation

rictic
Copy link
Contributor

@rictic rictic commented Mar 4, 2017

TODO: test strict querying.

  • CHANGELOG.md has been updated

/cc @usergenic as this affects bundling.

@rictic rictic requested a review from usergenic March 4, 2017 18:38
@rictic
Copy link
Contributor Author

rictic commented Mar 4, 2017

Part of handling Polymer/tools-sample-projects#3

@rictic rictic requested review from justinfagnani and removed request for usergenic March 4, 2017 18:39
* Do not include any features that are only reachable via paths that include
* lazy import edges.
*/
strictImports?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rename this to lazyImports with default true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd been going with the idea that everything was default false, to match the semantics of options.foo without explicit defaults handling stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

that's certainly a bit simpler, but the name here doesn't have a clear meaning to me. How about a convention of a "no" prefix for options we'd rather have a default of true. So noLazyImports?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1

const imports = scannedDocument.getNestedFeatures().filter(
(e) => e instanceof ScannedImport &&
e.type !== 'lazy-html-import') as ScannedImport[];
(e) => e instanceof ScannedImport) as ScannedImport[];
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought there were more places that needed fixup...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, got the other place in analysis-context

Copy link
Contributor

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

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

LGTM but Justin may still have comments

} else {
return;
}
const type = 'html-import';
Copy link
Contributor

Choose a reason for hiding this comment

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

no longer need type variable here, only used once below

@@ -238,14 +238,15 @@ export class Document implements Feature, Queryable {
getByKind(kind: string, options?: QueryOptions): Set<Feature>;
getByKind(kind: string, options?: QueryOptions): Set<Feature> {
options = options || {};
if (this._featuresByKind && options.imported) {
if (this._featuresByKind && options.imported && !options.strictImports) {
Copy link
Contributor

Choose a reason for hiding this comment

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

!options.strictImports is used in both checks below, can you pull it out of both and handle it separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1, this was a good clarity change

@MaKleSoft
Copy link
Contributor

This is approved so why has it not been merged yet? Was about to submit an almost identical PR before I saw this one...

@rictic
Copy link
Contributor Author

rictic commented Mar 18, 2017

I wanted to get feedback from Justin, but he's going on vacation, lemmy ping him, get his thoughts

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants