summaryrefslogtreecommitdiff
path: root/src/ast/dump.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-11-02 14:51:21 +0800
committerJohn Hodge <tpg@mutabah.net>2016-11-02 14:51:21 +0800
commit52c363340a4f2ee589d2e6753f1c685ef7b907f5 (patch)
tree758c04ec4aada28255cb5cd7865ad27025f29e7f /src/ast/dump.cpp
parent563520207ad1a6c0deff41b881ac5d0168d3439e (diff)
downloadmrust-52c363340a4f2ee589d2e6753f1c685ef7b907f5.tar.gz
All - Hack in start of macro hygine - requires rework so is disabled
Diffstat (limited to 'src/ast/dump.cpp')
-rw-r--r--src/ast/dump.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/ast/dump.cpp b/src/ast/dump.cpp
index fa31401a..33ef5911 100644
--- a/src/ast/dump.cpp
+++ b/src/ast/dump.cpp
@@ -922,20 +922,38 @@ void RustPrinter::print_pattern(const AST::Pattern& p, bool is_refutable)
),
(Slice,
m_os << "[";
+ m_os << v.sub_pats;
+ m_os << "]";
+ ),
+ (SplitSlice,
+ m_os << "[";
bool needs_comma = false;
if(v.leading.size()) {
m_os << v.leading;
- needs_comma = true;
+ m_os << ", ";
}
- if(v.extra_bind.size() > 0) {
- if( needs_comma ) {
- m_os << ", ";
+
+ if(v.extra_bind.is_valid())
+ {
+ const auto& b = v.extra_bind;
+ if( b.m_mutable )
+ m_os << "mut ";
+ switch(b.m_type)
+ {
+ case ::AST::PatternBinding::Type::MOVE:
+ break;
+ case ::AST::PatternBinding::Type::REF:
+ m_os << "ref ";
+ break;
+ case ::AST::PatternBinding::Type::MUTREF:
+ m_os << "ref mut ";
+ break;
}
- if(v.extra_bind != "_")
- m_os << v.extra_bind;
- m_os << "..";
- needs_comma = true;
+ m_os << b.m_name << "/*"<<b.m_slot<<"*/";
}
+ m_os << "..";
+ needs_comma = true;
+
if(v.trailing.size()) {
if( needs_comma ) {
m_os << ", ";