<commit_before>//
//  InstanceStorage.swift
//  Swinject
//
//  Created by <NAME> on 11/11/16.
//  Copyright © 2016 Swinject Contributors. All rights reserved.
//

/// Storage provided by `ObjectScope`. It is used by `Container` to persist resolved instances.
public protocol InstanceStorage: AnyObject {
    var instance: Any? { get set }
}

/// Persists stored instance until it is explicitly discarded.
public final class PermanentStorage: InstanceStorage {
    public var instance: Any?

    public init() {}
}

/// Does not persist stored instance.
public final class TransientStorage: InstanceStorage {
    public var instance: Any? {
        get { return nil }
        set {}
    }

    public init() {}
}

/// Does not persist value types.
/// Persists reference types as long as there are strong references to given instance.
public final class WeakStorage: InstanceStorage {
    private weak var object: AnyObject?

    public var instance: Any? {
        get { return object }
        set { object = newValue as AnyObject? }
    }

    public init () {}
}<commit_msg>Fix Any to AnyObject cast for linux environment<commit_after>//
//  InstanceStorage.swift
//  Swinject
//
//  Created by <NAME> on 11/11/16.
//  Copyright © 2016 Swinject Contributors. All rights reserved.
//

/// Storage provided by `ObjectScope`. It is used by `Container` to persist resolved instances.
public protocol InstanceStorage: AnyObject {
    var instance: Any? { get set }
}

/// Persists stored instance until it is explicitly discarded.
public final class PermanentStorage: InstanceStorage {
    public var instance: Any?

    public init() {}
}

/// Does not persist stored instance.
public final class TransientStorage: InstanceStorage {
    public var instance: Any? {
        get { return nil }
        set {}
    }

    public init() {}
}

/// Does not persist value types.
/// Persists reference types as long as there are strong references to given instance.
public final class WeakStorage: InstanceStorage {
    private weak var object: AnyObject?

    #if os(Linux)
    public var instance: Any? {
        get { return object }
        set { object = newValue.flatMap { $0 as? AnyObject } }
    }
    #else
    public var instance: Any? {
        get { return object }
        set { object = newValue as AnyObject? }
    }
    #endif

    public init () {}
}
{'fraction_non_alphanumeric': 0.09364406779661016, 'fraction_numerical': 0.008898305084745763, 'mean_word_length': 2.7416798732171155, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2462538', 'n_tokens_mistral': 656, 'n_tokens_neox': 624, 'n_words': 262}