summaryrefslogtreecommitdiff
path: root/src/dump_as_rust.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-25 23:09:17 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-25 23:09:17 +0800
commit6c16703e6a3be274c4fe183ffde10fd7a20f8236 (patch)
tree8a9b0ad911f73b9e2f6357fa6534e4583165dd40 /src/dump_as_rust.cpp
parent72e2a322f52edd7bf3f37ad840f2d48be4192d62 (diff)
downloadmrust-6c16703e6a3be274c4fe183ffde10fd7a20f8236.tar.gz
AST - Convert use statements to normal items
Diffstat (limited to 'src/dump_as_rust.cpp')
-rw-r--r--src/dump_as_rust.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dump_as_rust.cpp b/src/dump_as_rust.cpp
index 0a322ee5..8909e2e4 100644
--- a/src/dump_as_rust.cpp
+++ b/src/dump_as_rust.cpp
@@ -558,21 +558,23 @@ void RustPrinter::handle_module(const AST::Module& mod)
{
bool need_nl = true;
- for( const auto& i : mod.imports() )
+ for( const auto& i : mod.items() )
{
+ if( !i.data.is_Use() ) continue ;
+ const auto& i_data = i.data.as_Use();
//if(need_nl) {
// m_os << "\n";
// need_nl = false;
//}
- if( i.data.path == AST::Path() ) {
+ if( i_data.path == AST::Path() ) {
continue ;
}
- m_os << indent() << (i.is_pub ? "pub " : "") << "use " << i.data;
+ m_os << indent() << (i.is_pub ? "pub " : "") << "use " << i_data;
if( i.name == "" )
{
m_os << "::*";
}
- else if( i.data.path.nodes().back().name() != i.name )
+ else if( i_data.path.nodes().back().name() != i.name )
{
m_os << " as " << i.name;
}