From bd7fe3e47b9870c0c94e6bea48531cd3f212a84a Mon Sep 17 00:00:00 2001 From: Stephane Magne Date: Thu, 9 Jun 2022 14:26:58 -0700 Subject: [PATCH 1/2] Update the popDynamicResolver function to work from the end of the array instead of the front. Invert the ordering of pushed resolvers. --- Sources/WeaverCodeGen/SwiftGenerator.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/WeaverCodeGen/SwiftGenerator.swift b/Sources/WeaverCodeGen/SwiftGenerator.swift index 5eba2e6..81ed62a 100644 --- a/Sources/WeaverCodeGen/SwiftGenerator.swift +++ b/Sources/WeaverCodeGen/SwiftGenerator.swift @@ -340,7 +340,7 @@ private static var _dynamicResolvers = [Any]() private static var _dynamicResolversLock = NSRecursiveLock() fileprivate static func _popDynamicResolver(_ 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 @@ -863,7 +863,7 @@ static func _pushDynamicResolver(_ 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() @@ -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() From e1b51326c901731b6dc0f4e4db5b66eb21ca4d3d Mon Sep 17 00:00:00 2001 From: Stephane Magne Date: Thu, 9 Jun 2022 14:28:43 -0700 Subject: [PATCH 2/2] Update build to 1.1.1. --- Sources/WeaverCommand/Command.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WeaverCommand/Command.swift b/Sources/WeaverCommand/Command.swift index ecd741d..8395652 100644 --- a/Sources/WeaverCommand/Command.swift +++ b/Sources/WeaverCommand/Command.swift @@ -13,7 +13,7 @@ import Darwin import PathKit import Rainbow -private let version = "1.1.0" +private let version = "1.1.1" // MARK: - Linker