diff options
author | John Hodge <tpg@mutabah.net> | 2015-03-27 14:35:59 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-03-27 14:35:59 +0800 |
commit | aa324bf5be8e415a7e81460e6dca405a48fcbffb (patch) | |
tree | e3796b1af9683cf53e71c94cd1036e599c0cbaad /src/dump_as_rust.cpp | |
parent | 27362c07d86e3d24b75545916697f124d826bbc9 (diff) | |
download | mrust-aa324bf5be8e415a7e81460e6dca405a48fcbffb.tar.gz |
Split type and lifetime parameters apart
Diffstat (limited to 'src/dump_as_rust.cpp')
-rw-r--r-- | src/dump_as_rust.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/dump_as_rust.cpp b/src/dump_as_rust.cpp index 6155caec..bac9d104 100644 --- a/src/dump_as_rust.cpp +++ b/src/dump_as_rust.cpp @@ -660,18 +660,26 @@ void RustPrinter::handle_module(const AST::Module& mod) void RustPrinter::print_params(const AST::TypeParams& params) { - if( params.n_params() > 0 ) + if( params.ty_params().size() > 0 || params.lft_params().size() > 0 ) { bool is_first = true; m_os << "<"; - for( const auto& p : params.params() ) + // Lifetimes + for( const auto& p : params.lft_params() ) { if( !is_first ) m_os << ", "; - if( p.is_type() ) - m_os << p.name() << " = " << p.get_default(); - else - m_os << "'" << p.name(); + m_os << "'" << p; + is_first = false; + } + // Types + for( const auto& p : params.ty_params() ) + { + if( !is_first ) + m_os << ", "; + m_os << p.name(); + if( !p.get_default().is_wildcard() ) + m_os << " = " << p.get_default(); is_first = false; } m_os << ">"; |