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

Ignore orphan scopes #290

Merged
merged 2 commits into from
May 8, 2019
Merged

Ignore orphan scopes #290

merged 2 commits into from
May 8, 2019

Conversation

neakor
Copy link
Contributor

@neakor neakor commented May 8, 2019

Orphan scopes are the scopes that do not ultimately end at a subclass of RootComponent. This means they are detached and therefore cannot be provided for. This change ignores parsing these orphans.

Also updated samples and documentation to reflect this new root API change.

Fixes #272

Orphan scopes are the scopes that do not ultimately end at a subclass of `RootComponent`. This means they are detached and therefore cannot be provided for. This change ignores parsing these orphans.

Also updated samples and documentation to reflect this new root API change.
@neakor neakor requested a review from rudro May 8, 2019 00:33
return ancestorPaths(for: component)
.map { (path: [Component]) -> DependencyProvider in
return DependencyProvider(path: path, dependency: component.dependency)
.filter { !$0.isEmpty }
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: this filter is pretty much the guard let + compactMap combo in the next 3 lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah you are right. The downside is I can't remove the guard since first returns optional. And of course we need the compactMap.

@neakor
Copy link
Contributor Author

neakor commented May 8, 2019

Travis is not reporting back but everything actually passed.

@neakor neakor merged commit 0a59a2b into master May 8, 2019
@neakor neakor deleted the generator-ignore_orphans-master branch May 8, 2019 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make root of a DI tree explicit
2 participants