summaryrefslogtreecommitdiff
path: root/src/dump_as_rust.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2015-03-25 21:37:29 +0800
committerJohn Hodge <tpg@mutabah.net>2015-03-25 21:37:29 +0800
commit66880a641295734c437feb4eb32fb60bf5cd9af5 (patch)
tree723f47d10888e737548031b0d183cf30c0393121 /src/dump_as_rust.cpp
parent56601285b24450168e8b1853ae9c8b65f4576cb0 (diff)
downloadmrust-66880a641295734c437feb4eb32fb60bf5cd9af5.tar.gz
Macros updated with concat!, stringify!, and $crate
Diffstat (limited to 'src/dump_as_rust.cpp')
-rw-r--r--src/dump_as_rust.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dump_as_rust.cpp b/src/dump_as_rust.cpp
index 764f5a86..b8fb1647 100644
--- a/src/dump_as_rust.cpp
+++ b/src/dump_as_rust.cpp
@@ -643,7 +643,10 @@ void RustPrinter::print_params(const AST::TypeParams& params)
{
if( !is_first )
m_os << ", ";
- m_os << p.name();
+ if( p.is_type() )
+ m_os << p.name() << " = " << p.get_default();
+ else
+ m_os << "'" << p.name();
is_first = false;
}
m_os << ">";
@@ -741,13 +744,14 @@ void RustPrinter::handle_struct(const AST::Struct& s)
if( s.fields().size() == 0 )
{
- m_os << "()\n";
+ m_os << " /* unit-like */\n";
print_bounds(s.params());
m_os << indent() << ";\n";
}
else if( s.fields().size() == 1 && s.fields()[0].name == "" )
{
- m_os << "(" << "" <<")\n";
+ const auto& tuple = s.fields()[0].data;
+ m_os << "(" << tuple.print_pretty() <<")\n";
print_bounds(s.params());
m_os << indent() << ";\n";
}