diff options
author | John Hodge <tpg@mutabah.net> | 2015-03-19 10:49:11 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-03-19 10:49:11 +0800 |
commit | 2eb0ef0364591ff9ad30fcefa795bfd8eba17dea (patch) | |
tree | 2e53c6ee1034f90b853f1d194722e268d70dd02f /src/ast/pattern.hpp | |
parent | ca09043bcadaacd7256a9b5d60b2358434743da6 (diff) | |
download | mrust-2eb0ef0364591ff9ad30fcefa795bfd8eba17dea.tar.gz |
EVIL tagged union hackjob
Diffstat (limited to 'src/ast/pattern.hpp')
-rw-r--r-- | src/ast/pattern.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ast/pattern.hpp b/src/ast/pattern.hpp index a2f9a24b..a9a944fb 100644 --- a/src/ast/pattern.hpp +++ b/src/ast/pattern.hpp @@ -33,6 +33,16 @@ private: unique_ptr<ExprNode> m_node; unique_ptr<ExprNode> m_node2; // ONLY used for range values ::std::vector<Pattern> m_sub_patterns; + + TAGGED_ENUM(Data, Any, + (Any, () ), + (Ref, (bool mut; unique_ptr<ExprNode> 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;) ) + ); + public: Pattern(Pattern&& o) noexcept: m_class(o.m_class), |