summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2015-03-25 22:52:22 +0800
committerJohn Hodge <tpg@mutabah.net>2015-03-25 22:52:22 +0800
commit0dec25af084dcb27500d840e4afabe6ad7e65a9e (patch)
tree3bfb8b4cd570a7c4da399310726625d75e8625d4
parent7fef87364af0fea2ef5db89385674c9c3b892ec2 (diff)
downloadmrust-0dec25af084dcb27500d840e4afabe6ad7e65a9e.tar.gz
Printing cleanup, missing resolve locations
-rw-r--r--src/dump_as_rust.cpp7
-rw-r--r--src/types.cpp5
2 files changed, 10 insertions, 2 deletions
diff --git a/src/dump_as_rust.cpp b/src/dump_as_rust.cpp
index b8fb1647..f3fd8f83 100644
--- a/src/dump_as_rust.cpp
+++ b/src/dump_as_rust.cpp
@@ -221,7 +221,10 @@ public:
AST::NodeVisitor::visit(arm.m_cond);
}
m_os << " => ";
+ // Increase indent, but don't print. Causes nested blocks to be indented above the match
+ inc_indent();
AST::NodeVisitor::visit(arm.m_code);
+ dec_indent();
m_os << ",\n";
}
@@ -299,8 +302,9 @@ public:
m_os << ": ";
print_type(arg.second);
}
- m_os << "|: ";
+ m_os << "| ->";
print_type(n.m_return);
+ m_os << " ";
AST::NodeVisitor::visit(n.m_code);
}
virtual void visit(AST::ExprNode_Integer& n) override {
@@ -558,6 +562,7 @@ void RustPrinter::handle_module(const AST::Module& mod)
m_os << " = " << i.data.type();
print_bounds(i.data.params());
m_os << ";\n";
+ m_os << "\n";
}
need_nl = true;
diff --git a/src/types.cpp b/src/types.cpp
index 4082bc96..101a3971 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -397,7 +397,10 @@ bool TypeRef::operator==(const TypeRef& x) const
break;
case TypeRef::TUPLE:
//os << "TagTuple, {" << tr.m_inner_types << "}";
- os << "(" << tr.m_inner_types << ",)";
+ os << "( ";
+ for( const auto& it : tr.m_inner_types )
+ os << it << ", ";
+ os << ")";
break;
case TypeRef::REFERENCE:
//os << "TagReference, " << (tr.m_is_inner_mutable ? "mut" : "const") << ", " << tr.m_inner_types[0];