diff options
author | John Hodge <tpg@mutabah.net> | 2016-03-20 12:29:44 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-03-20 12:29:44 +0800 |
commit | b79e71e5f11e14516f13ea2f8437d5deaa10e653 (patch) | |
tree | 3097c0251c83e32e4e673a840f5708110a8adc4c /src/ast/pattern.hpp | |
parent | 0ee80748a3dcb97f308e9b0b71c22d28868d12cf (diff) | |
download | mrust-b79e71e5f11e14516f13ea2f8437d5deaa10e653.tar.gz |
Tagged Union - Rework to remove indirection
Diffstat (limited to 'src/ast/pattern.hpp')
-rw-r--r-- | src/ast/pattern.hpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ast/pattern.hpp b/src/ast/pattern.hpp index b844eba9..b8e86b70 100644 --- a/src/ast/pattern.hpp +++ b/src/ast/pattern.hpp @@ -25,16 +25,16 @@ public: BIND_MUTREF, }; TAGGED_UNION(Data, Any, - (MaybeBind, () ), - (Macro, (unique_ptr<::AST::MacroInvocation> inv;) ), - (Any, () ), - (Box, (unique_ptr<Pattern> sub;) ), - (Ref, (bool mut; unique_ptr<Pattern> sub;) ), - (Value, (unique_ptr<ExprNode> start; unique_ptr<ExprNode> end;) ), - (Tuple, (::std::vector<Pattern> sub_patterns;) ), - (StructTuple, (Path path; ::std::vector<Pattern> sub_patterns;) ), - (Struct, (Path path; ::std::vector< ::std::pair< ::std::string,Pattern> > sub_patterns;) ), - (Slice, (::std::vector<Pattern> leading; ::std::string extra_bind; ::std::vector<Pattern> trailing;) ) + (MaybeBind, struct { } ), + (Macro, struct { unique_ptr<::AST::MacroInvocation> inv; } ), + (Any, struct { } ), + (Box, struct { unique_ptr<Pattern> sub; } ), + (Ref, struct { bool mut; unique_ptr<Pattern> sub; } ), + (Value, struct { unique_ptr<ExprNode> start; unique_ptr<ExprNode> end; } ), + (Tuple, struct { ::std::vector<Pattern> sub_patterns; } ), + (StructTuple, struct { Path path; ::std::vector<Pattern> sub_patterns; } ), + (Struct, struct { Path path; ::std::vector< ::std::pair< ::std::string, Pattern> > sub_patterns; } ), + (Slice, struct { ::std::vector<Pattern> leading; ::std::string extra_bind; ::std::vector<Pattern> trailing; } ) ); private: ::std::string m_binding; |