diff options
author | John Hodge <tpg@mutabah.net> | 2016-05-29 22:30:28 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-05-29 22:30:28 +0800 |
commit | 7890a6dba8fcdb9454b2e58ea1363f270d2da2c5 (patch) | |
tree | fa51d39712f552c78b390d61d19793c737d5238a /src/ast/pattern.cpp | |
parent | 73bcd2fb0bda8f939a6c1385b419a67ad8eeef2c (diff) | |
download | mrust-7890a6dba8fcdb9454b2e58ea1363f270d2da2c5.tar.gz |
Parse/AST/HIR - Support Enum::Var(..) and Struct { .. } patters properly
Diffstat (limited to 'src/ast/pattern.cpp')
-rw-r--r-- | src/ast/pattern.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ast/pattern.cpp b/src/ast/pattern.cpp index ca5378e1..9e17abcf 100644 --- a/src/ast/pattern.cpp +++ b/src/ast/pattern.cpp @@ -70,6 +70,9 @@ namespace AST { (Tuple, os << "(" << ent.sub_patterns << ")"; ), + (WildcardStructTuple, + os << ent.path << " (..)"; + ), (StructTuple, os << ent.path << " (" << ent.sub_patterns << ")"; ), @@ -220,6 +223,9 @@ AST::Pattern AST::Pattern::clone() const (Tuple, rv.m_data = Data::make_Tuple({ H::clone_list(e.sub_patterns) }); ), + (WildcardStructTuple, + rv.m_data = Data::make_WildcardStructTuple({ ::AST::Path(e.path) }); + ), (StructTuple, rv.m_data = Data::make_StructTuple({ ::AST::Path(e.path), H::clone_list(e.sub_patterns) }); ), @@ -263,6 +269,9 @@ SERIALISE_TYPE(Pattern::, "Pattern", { (Tuple, s << e.sub_patterns; ), + (WildcardStructTuple, + s << e.path; + ), (StructTuple, s << e.path; s << e.sub_patterns; @@ -304,6 +313,9 @@ SERIALISE_TYPE(Pattern::, "Pattern", { _D(Tuple, s.item( ent.sub_patterns ); ) + _D(WildcardStructTuple, + s.item( ent.path ); + ) _D(StructTuple, s.item( ent.path ); s.item( ent.sub_patterns ); |