0001    //
0002    //  ResolutionPool.swift
0003    //  Swinject
0004    //
0005    //  Created by Yoichi Tagaya on 7/28/15.
0006    //  Copyright (c) 2015 Swinject Contributors. All rights reserved.
0007    //
0008    
0009    import Foundation
0010    
0011    internal struct ResolutionPool
Container.swift:32
    private var resolutionPool = ResolutionPool()
ResolutionPool.swift:23
        guard depth < ResolutionPool.maxDepth else {
{ 0012 private static let maxDepth
ResolutionPool.swift:23
        guard depth < ResolutionPool.maxDepth else {
= 200 0013 0014 private var pool
ResolutionPool.swift:18
        get { return pool[key] }
ResolutionPool.swift:19
        set { pool[key] = newValue }
ResolutionPool.swift:35
            pool = [:]
= [ServiceKey: Any]() 0015 private var depth
ResolutionPool.swift:23
        guard depth < ResolutionPool.maxDepth else {
ResolutionPool.swift:27
        depth += 1
ResolutionPool.swift:31
        assert(depth > 0, "The depth cannot be negative.")
ResolutionPool.swift:33
        depth -= 1
ResolutionPool.swift:34
        if depth == 0 {
: Int = 0 0016 0017 internal subscript
Container.swift:188
        if usesPool, let pooledInstance = resolutionPool[key] as? Service {
Container.swift:194
            if let pooledInstance = resolutionPool[key] as? Service {
Container.swift:198
            resolutionPool[key] = resolvedInstance as Any
(key: ServiceKey) -> Any? { 0018 get { return pool[key] } 0019 set { pool[key] = newValue } 0020 } 0021 0022 internal mutating func incrementDepth
Container.swift:142
        resolutionPool.incrementDepth()
() { 0023 guard depth < ResolutionPool.maxDepth else { 0024 fatalError("Infinite recursive call for circular dependency has been detected. " + 0025 "To avoid the infinite call, 'initCompleted' handler should be used to inject circular dependency.") 0026 } 0027 depth += 1 0028 } 0029 0030 internal mutating func decrementDepth
Container.swift:143
        defer { resolutionPool.decrementDepth() }
() { 0031 assert(depth > 0, "The depth cannot be negative.") 0032 0033 depth -= 1 0034 if depth == 0 { 0035 pool = [:] 0036 } 0037 } 0038 } 0039