func applyParamTemplate()

in Sources/MockoloFramework/Templates/ParamTemplate.swift [20:42]


    func applyParamTemplate(name: String,
                            label: String,
                            type: SwiftType,
                            inInit: Bool,
                            isGeneric: Bool) -> String {
        var result = name
        if !label.isEmpty {
            result = "\(label) \(name)"
        }
        if isGeneric {
            // FIXME: `type` is used as a generic constraint
            if !type.isVoid {
                result = "\(result): \(type.typeName)"
            }
        } else {
            result = "\(result): \(type.typeName)"
        }

        if inInit, let defaultVal = type.defaultVal() {
            result = "\(result) = \(defaultVal)"
        }
        return result
    }