summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/slice2swift/Gen.cpp16
-rw-r--r--cpp/src/slice2swift/SwiftUtil.cpp12
-rw-r--r--cpp/src/slice2swift/SwiftUtil.h2
3 files changed, 22 insertions, 8 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp
index b00cf98f846..7bfda21774e 100644
--- a/cpp/src/slice2swift/Gen.cpp
+++ b/cpp/src/slice2swift/Gen.cpp
@@ -420,23 +420,23 @@ Gen::TypesVisitor::visitStructStart(const StructPtr& p)
void
Gen::TypesVisitor::visitSequence(const SequencePtr& p)
{
- const string name = fixIdent(p->name());
- const TypePtr type = p->type();
+ const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p)));
+ const string name = getUnqualified(getAbsolute(p), swiftModule);
out << sp;
- out << nl << "public typealias " << name << " = [" << typeToString(type, p) << "]";
+ out << nl << "public typealias " << name << " = [" << typeToString(p->type(), p) << "]";
}
void
Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
{
- const string name = fixIdent(p->name());
-
- const TypePtr keyType = p->keyType();
- const TypePtr valueType = p->valueType();
+ const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p)));
+ const string name = getUnqualified(getAbsolute(p), swiftModule);
out << sp;
- out << nl << "public typealias " << name << " = [" << typeToString(keyType, p) << ":" << typeToString(valueType, p)
+ out << nl << "public typealias " << name << " = ["
+ << typeToString(p->keyType(), p) << ":"
+ << typeToString(p->valueType(), p)
<< "]";
}
diff --git a/cpp/src/slice2swift/SwiftUtil.cpp b/cpp/src/slice2swift/SwiftUtil.cpp
index 3da66678f8a..441716c8769 100644
--- a/cpp/src/slice2swift/SwiftUtil.cpp
+++ b/cpp/src/slice2swift/SwiftUtil.cpp
@@ -421,6 +421,18 @@ SwiftGenerator::getAbsolute(const ConstPtr& en)
}
string
+SwiftGenerator::getAbsolute(const SequencePtr& en)
+{
+ return getAbsoluteImpl(en);
+}
+
+string
+SwiftGenerator::getAbsolute(const DictionaryPtr& en)
+{
+ return getAbsoluteImpl(en);
+}
+
+string
SwiftGenerator::getUnqualified(const string& type, const string& localModule)
{
const string prefix = localModule + ".";
diff --git a/cpp/src/slice2swift/SwiftUtil.h b/cpp/src/slice2swift/SwiftUtil.h
index 297ba0c18b0..122eb928759 100644
--- a/cpp/src/slice2swift/SwiftUtil.h
+++ b/cpp/src/slice2swift/SwiftUtil.h
@@ -48,6 +48,8 @@ protected:
std::string getAbsolute(const ExceptionPtr&);
std::string getAbsolute(const EnumPtr&);
std::string getAbsolute(const ConstPtr&);
+ std::string getAbsolute(const SequencePtr&);
+ std::string getAbsolute(const DictionaryPtr&);
std::string getUnqualified(const std::string&, const std::string&);
std::string modeToString(Operation::Mode);