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 dependency resolver ordering #169

Open
wants to merge 2 commits into
base: stephane/backup
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions Sources/WeaverCodeGen/SwiftGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private static var _dynamicResolvers = [Any]()
private static var _dynamicResolversLock = NSRecursiveLock()

fileprivate static func _popDynamicResolver<Resolver>(_ resolverType: Resolver.Type) -> Resolver {
guard let dynamicResolver = _dynamicResolvers.removeFirst() as? Resolver else {
guard let dynamicResolver = _dynamicResolvers.removeLast() as? Resolver else {
\(TypeIdentifier.mainDependencyContainer.swiftString).fatalError()
}
return dynamicResolver
Expand Down Expand Up @@ -863,7 +863,7 @@ static func _pushDynamicResolver<Resolver>(_ resolver: Resolver) {
return nil
}
})
.adding(members: try dependencyContainer.dependencies.orderedValues.compactMap { dependency in
.adding(members: try dependencyContainer.dependencies.orderedValues.reversed().compactMap { dependency in
guard dependency.annotationStyle == .propertyWrapper else { return nil }
let declaration = try self.declaration(for: dependency)
return TypeIdentifier.mainDependencyContainer.reference + .named("_pushDynamicResolver") | .call(Tuple()
Expand Down Expand Up @@ -1235,7 +1235,7 @@ private extension MetaWeaverFile {
value: Reference.named(parameter.dependencyName)
)
})
.adding(members: try dependencyContainer.dependencies.orderedValues.compactMap { dependency in
.adding(members: try dependencyContainer.dependencies.orderedValues.reversed().compactMap { dependency in
guard dependency.annotationStyle == .propertyWrapper else { return nil }
let declaration = try self.declaration(for: dependency)
return TypeIdentifier.mainDependencyContainer.reference + .named("_pushDynamicResolver") | .call(Tuple()
Expand Down
2 changes: 1 addition & 1 deletion Sources/WeaverCommand/Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Darwin
import PathKit
import Rainbow

private let version = "1.1.0"
private let version = "1.1.1"

// MARK: - Linker

Expand Down