 }
 
 
+/// Swift code for auto-prefixed arguments
+public func codeFor(argument a: GIR.Argument) -> String {
+    let prefixedname = a.prefixedArgumentName
+    let type = a.argumentType
+    let code = "\(prefixedname): \(type)"
+    return code
+}
+
+
 /// Swift code for methods
-public func argumentCode(_ arg: GIR.Argument) -> String {
-    let prefixedname = arg.prefixedArgumentName
-    let type = arg.argumentType
-    let code = "\(prefixedname): \(type)"
+public func codeFor(argument a: GIR.Argument, prefix: String) -> String {
+    let name = a.argumentName
+    let type = a.argumentType
+    let code = "\(prefix) \(name): \(type)"
     return code
 }
 

            let fname = override ? (method.cname.afterFirst() ?? (record.name + name.capitalised)) : name
            let deprecated = method.deprecated != nil ? "@available(*, deprecated) " : ""
            let consPrefix = constructorPrefix(method)
            let prefix = consPrefix == firstArgName?.swift ? "" : (consPrefix + " ")
            let fact = factory ? "static func \(fname.swift)(" : "\(conv)init(\(prefix)"
            let code = swiftCode(method, indentation + "\(deprecated)public \(fact)" +
                constructorParam(method) + ")\(returnDeclaration(method)) {\n" +
                    doubleIndent + call(method) +
                    indentation  + ret(method)  +
                "}\n", indentation: indentation)



/// Swift code for the parameters of a constructor
public func constructorParam(_ method: GIR.Method, prefix: String?) -> String {
    let comma = ", "
    let args = method.args
    guard let first = args.first else { return "" }
    guard let p = prefix else { return args.map(codeFor).joined(separator: comma) }
    let firstParam = codeFor(argument: first, prefix: p)
    let n = args.count
    guard n > 1 else { return firstParam }
    let tail = args[1..<n-1]
    return firstParam + comma + tail.map(codeFor).joined(separator: comma)
}


