Skip to content

Commit

Permalink
Merge pull request #8 from TransitApp/fix-issue-with-imports-in-objc-…
Browse files Browse the repository at this point in the history
…with-inheritance
  • Loading branch information
FlavienSi authored Mar 29, 2023
2 parents 6aa1414 + 83f49c5 commit 3cdc310
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/source/ObjcppGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,17 @@ class ObjcppGenerator(spec: Spec) extends BaseObjcGenerator(spec) {
}

override def generateRecord(origin: String, ident: Ident, doc: Doc, params: Seq[TypeParam], r: Record, idl: Seq[TypeDecl]) {
val (superFields, firstInitializerArg) = getSuperRecord(idl, r) match {
case None => (Seq.empty, if(r.fields.isEmpty) "" else IdentStyle.camelUpper("with_" + r.fields.head.ident.name))
case Some(value) => (value.fields, if(value.fields.isEmpty) "" else IdentStyle.camelUpper("with_" + value.fields.head.ident.name))
}

val fields = superFields ++ r.fields

val refs = new ObjcRefs()
for (c <- r.consts)
refs.find(c.ty)
for (f <- r.fields)
for (f <- fields)
refs.find(f.ty)

val objcName = ident.name + (if (r.ext.objc) "_base" else "")
Expand Down Expand Up @@ -385,13 +392,6 @@ class ObjcppGenerator(spec: Spec) extends BaseObjcGenerator(spec) {
writeObjcFile(privateBodyName(objcName), origin, refs.body, w => {
wrapNamespace(w, spec.objcppNamespace, w => {

val (superFields, firstInitializerArg) = getSuperRecord(idl, r) match {
case None => (Seq.empty, if(r.fields.isEmpty) "" else IdentStyle.camelUpper("with_" + r.fields.head.ident.name))
case Some(value) => (value.fields, if(value.fields.isEmpty) "" else IdentStyle.camelUpper("with_" + value.fields.head.ident.name))
}

val fields = superFields ++ r.fields

w.wl(s"auto $helperClass::toCpp(ObjcType obj) -> CppType")
w.braced {
w.wl("assert(obj);")
Expand Down

0 comments on commit 3cdc310

Please sign in to comment.