         let pointee = ptr + ".pointee." + name
         guard field.isReadable || field.isWritable else { return indentation + "// var \(name) is unavailable because it is neigher readable nor writable\n" }
         guard !field.isVoid else { return indentation + "// var \(swname) is unavailable because \(name) is void\n" }
-        let ptrLevel = containedTypeRef.indirectionLevel
+        let ptrLevel = fieldTypeRef.indirectionLevel
         let idiomaticRef = containedTypeRef.idiomaticType
         let typeName: String
         if let tupleSize = field.tupleSize {

        }
        let setterCode: String
        if field.isWritable {
            let setterBody = instanceSetter(for: field, ref: idiomaticRef, knownRecord: knownRecord, indentation: doubleIndent, record, target: pointee, ptr: "newValue")
            setterCode = swiftCode(field, doubleIndent + "\(deprecated) set {\n" +
                doubleIndent + indentation + setterBody + "\n" +
                doubleIndent + "}\n", indentation: doubleIndent)

        return code
    }
}

/// Swift code for the parameters of a constructor
public func constructorParam(_ method: GIR.Method, prefix: String?) -> String {
