@@ -101,7 +101,7 @@ class SwiftGenerator(spec: Spec) extends Generator(spec) {
101101 }
102102 })
103103 writeSwiftPrivateFile(ident, origin, List [String ](" DjinniSupport" , spec.swiftModule), w => {
104- w.wl(s " typealias ${marshal.typename(ident, e)}Marshaller = DjinniSupport.EnumMarshaller< ${marshal.typename(ident, e)}> " )
104+ w.wl(s " public typealias ${marshal.typename(ident, e)}Marshaller = DjinniSupport.EnumMarshaller< ${marshal.typename(ident, e)}> " )
105105 })
106106 }
107107
@@ -206,9 +206,9 @@ class SwiftGenerator(spec: Spec) extends Generator(spec) {
206206 }
207207 })
208208 writeSwiftPrivateFile(ident, origin, refs.privateImports, w => {
209- w.w(s " enum ${marshal.typename(ident, r)}Marshaller: DjinniSupport.Marshaller " ).braced {
210- w.wl(s " typealias SwiftType = ${marshal.fqTypename(ident, r)}" )
211- w.w(" static func fromCpp(_ c: djinni.swift.AnyValue) -> SwiftType" ).braced {
209+ w.w(s " public enum ${marshal.typename(ident, r)}Marshaller: DjinniSupport.Marshaller " ).braced {
210+ w.wl(s " public typealias SwiftType = ${marshal.fqTypename(ident, r)}" )
211+ w.w(" public static func fromCpp(_ c: djinni.swift.AnyValue) -> SwiftType" ).braced {
212212 w.wl(" return withUnsafePointer(to: c) { p in" ).nested {
213213 for ((f, i) <- r.fields.view.zipWithIndex) {
214214 val swiftExp = s " djinni.swift.getMember(p, $i) "
@@ -219,7 +219,7 @@ class SwiftGenerator(spec: Spec) extends Generator(spec) {
219219 }
220220 w.wl(" }" )
221221 }
222- w.w(" static func toCpp(_ s: SwiftType) -> djinni.swift.AnyValue" ).braced {
222+ w.w(" public static func toCpp(_ s: SwiftType) -> djinni.swift.AnyValue" ).braced {
223223 if (r.fields.nonEmpty) {
224224 w.wl(" var ret = djinni.swift.makeCompositeValue()" )
225225 for (f <- r.fields) {
@@ -267,12 +267,12 @@ class SwiftGenerator(spec: Spec) extends Generator(spec) {
267267 if (m.params.nonEmpty) { w.w(" _ " ) }
268268 w.w(m.params.map(p => s " ${idSwift.local(p.ident)}: ${marshal.fqParamType(p.ty)}" ).mkString(" , " ))
269269 w.w(s " ) throws -> ${marshal.fqReturnType(m.ret)}" ).braced {
270- w.wl(" var params = djinni.swift.ParameterList()" )
271- w.wl(" params .addValue(inst)" )
270+ w.wl(" var _params = djinni.swift.ParameterList()" )
271+ w.wl(" _params .addValue(inst)" )
272272 for (p <- m.params) {
273- w.wl(s " params .addValue( ${marshal.toCpp(p.ty, idSwift.local(p.ident))}) " )
273+ w.wl(s " _params .addValue( ${marshal.toCpp(p.ty, idSwift.local(p.ident))}) " )
274274 }
275- w.wl(s " var ret = ${spec.swiftxxNamespace}. ${marshal.typename(ident, i)}_ ${idSwift.method(m.ident)}(¶ms ) " )
275+ w.wl(s " var ret = ${spec.swiftxxNamespace}. ${marshal.typename(ident, i)}_ ${idSwift.method(m.ident)}(&_params ) " )
276276 w.wl(" try handleCppErrors(&ret)" )
277277 if (! m.ret.isEmpty) {
278278 w.wl(s " return ${marshal.fromCpp(m.ret.get, " ret" )}" )
@@ -310,13 +310,13 @@ class SwiftGenerator(spec: Spec) extends Generator(spec) {
310310 w.wl
311311 }
312312 // Define the marshaller
313- w.w(s " enum ${marshal.typename(ident, i)}Marshaller: DjinniSupport.Marshaller " ).braced {
314- w.wl(s " typealias SwiftType = ${marshal.fqTypename(ident, i)}" )
315- w.w(" static func fromCpp(_ c: djinni.swift.AnyValue) -> SwiftType" ).braced {
313+ w.w(s " public enum ${marshal.typename(ident, i)}Marshaller: DjinniSupport.Marshaller " ).braced {
314+ w.wl(s " public typealias SwiftType = ${marshal.fqTypename(ident, i)}" )
315+ w.w(" public static func fromCpp(_ c: djinni.swift.AnyValue) -> SwiftType" ).braced {
316316 val newProxyBlock = if (i.ext.cpp) {s " { ${marshal.typename(ident, i)}CppProxy(c) as SwiftType } " } else {" { fatalError(\" n/a\" ) }" }
317317 w.wl(s " return cppInterfaceToSwift(c, ${newProxyBlock}) " )
318318 }
319- w.w(" static func toCpp(_ s: SwiftType) -> djinni.swift.AnyValue" ).braced {
319+ w.w(" public static func toCpp(_ s: SwiftType) -> djinni.swift.AnyValue" ).braced {
320320 val newProxyBlock = if (i.ext.swift) {s " { ${spec.swiftxxNamespace}. $swiftProxyClassName.make(ctxPtr(s, ${swiftProxyVtbl}), dispatcherProtocalCall)} " } else {" { fatalError(\" n/a\" ) }" }
321321 w.wl(s " return swiftInterfaceToCpp(s, ${newProxyBlock}) " )
322322 }
@@ -330,11 +330,11 @@ class SwiftGenerator(spec: Spec) extends Generator(spec) {
330330 if (m.params.nonEmpty) { w.w(" _ " ) }
331331 w.w(m.params.map(p => s " ${idSwift.local(p.ident)}: ${marshal.fqParamType(p.ty)}" ).mkString(" , " ))
332332 w.w(s " ) throws -> ${marshal.fqReturnType(m.ret)}" ).braced {
333- w.wl(" var params = djinni.swift.ParameterList()" )
333+ w.wl(" var _params = djinni.swift.ParameterList()" )
334334 for (p <- m.params) {
335- w.wl(s " params .addValue( ${marshal.toCpp(p.ty, idSwift.local(p.ident))}) " )
335+ w.wl(s " _params .addValue( ${marshal.toCpp(p.ty, idSwift.local(p.ident))}) " )
336336 }
337- w.wl(s " var ret = ${spec.swiftxxNamespace}. ${marshal.typename(ident, i)}_ ${idSwift.method(m.ident)}(¶ms ) " )
337+ w.wl(s " var ret = ${spec.swiftxxNamespace}. ${marshal.typename(ident, i)}_ ${idSwift.method(m.ident)}(&_params ) " )
338338 w.wl(" try handleCppErrors(&ret)" )
339339 if (! m.ret.isEmpty) {
340340 w.wl(s " return ${marshal.fromCpp(m.ret.get, " ret" )}" )
0 commit comments