Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Extern type defined with generic parameters incorrectly generated in C++ #313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/source/CppMarshal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class CppMarshal(spec: Spec) extends Marshal(spec) {
}
withNs(ns, name)
}
def base(m: Meta): String = m match {
def base(m: Meta, args: String): String = m match {
case p: MPrimitive => p.cName
case MString => if (spec.cppUseWideStrings) "std::wstring" else "std::string"
case MDate => "std::chrono::system_clock::time_point"
Expand All @@ -162,8 +162,8 @@ class CppMarshal(spec: Spec) extends Marshal(spec) {
case DInterface => s"std::shared_ptr<${withNamespace(idCpp.ty(d.name))}>"
}
case e: MExtern => e.defType match {
case DInterface => s"std::shared_ptr<${e.cpp.typename}>"
case _ => e.cpp.typename
case DInterface => s"std::shared_ptr<${e.cpp.typename + args}>"
case _ => e.cpp.typename + args
}
case p: MParam => idCpp.typeParam(p.name)
}
Expand All @@ -177,18 +177,18 @@ class CppMarshal(spec: Spec) extends Marshal(spec) {
case d: MDef =>
d.defType match {
case DInterface => s"${nnType}<${withNamespace(idCpp.ty(d.name))}>"
case _ => base(tm.base) + args
case _ => base(tm.base, args)
}
case MOptional =>
tm.args.head.base match {
case d: MDef =>
d.defType match {
case DInterface => s"std::shared_ptr<${withNamespace(idCpp.ty(d.name))}>"
case _ => base(tm.base) + args
case _ => base(tm.base, args)
}
case _ => base(tm.base) + args
case _ => base(tm.base, args)
}
case _ => base(tm.base) + args
case _ => base(tm.base, args)
}
}
case None =>
Expand All @@ -197,7 +197,7 @@ class CppMarshal(spec: Spec) extends Marshal(spec) {
expr(tm.args.head)
} else {
val args = if (tm.args.isEmpty) "" else tm.args.map(expr).mkString("<", ", ", ">")
base(tm.base) + args
base(tm.base, args)
}
}
}
Expand Down