diff options
author | John Hodge <tpg@mutabah.net> | 2016-12-04 11:48:57 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-12-04 11:48:57 +0800 |
commit | 1f9e3bef9c395d792db1ea5e54b2b57a6dae4510 (patch) | |
tree | 7a787790f6afd27741cefcfee633b6d76edc5689 /src/trans/mangling.cpp | |
parent | 4f33805f7e44c25b23675545d758f0aa82f13f5e (diff) | |
download | mrust-1f9e3bef9c395d792db1ea5e54b2b57a6dae4510.tar.gz |
Trans - Hacking along
Diffstat (limited to 'src/trans/mangling.cpp')
-rw-r--r-- | src/trans/mangling.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/trans/mangling.cpp b/src/trans/mangling.cpp index fc85f532..c5c568d9 100644 --- a/src/trans/mangling.cpp +++ b/src/trans/mangling.cpp @@ -4,6 +4,15 @@ * * trans/mangling.hpp * - Name mangling support + * + * + * $D = ! type + * $A = Array + * $S = *-ptr + * $R = &-ptr + * $P = + symbol + * $E = = symbol + * $pL/$pR = Left/right paren */ #include "mangling.hpp" #include <hir/type.hpp> @@ -27,10 +36,10 @@ BUG(Span(), "UfcsUnknown - " << path); ), (UfcsKnown, - return FMT_CB(ss, ); + return FMT_CB(ss, ss << "/*ufcsknown*/";); ), (UfcsInherent, - return FMT_CB(ss, ); + return FMT_CB(ss, ss << "/*ufcsinherent*/"; ); ) ) throw ""; @@ -54,7 +63,17 @@ BUG(Span(), "Generic in trans - " << ty); ), (TraitObject, - BUG(Span(), "Raw trait object - " << ty); + return FMT_CB(ss, + ss << "$pL"; + ss << Trans_Mangle(te.m_trait.m_path); + for(const auto& bound : te.m_trait.m_type_bounds) { + ss << "_" << bound.first << "$E" << Trans_Mangle(bound.second); + } + for(const auto& marker : te.m_markers) { + ss << "$P" << Trans_Mangle(marker); + } + ss << "$pR"; + ); ), (ErasedType, BUG(Span(), "ErasedType in trans - " << ty); @@ -86,7 +105,7 @@ ), (Pointer, return FMT_CB(ss, - ss << "$P"; + ss << "$S"; switch(te.type) { case ::HIR::BorrowType::Shared: ss << "s"; break; |