diff options
author | John Hodge <tpg@mutabah.net> | 2016-09-25 21:23:07 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-09-25 21:23:07 +0800 |
commit | 36e197f903ba19229b35cdd7c5bea045ca34dcdc (patch) | |
tree | 547ffd0f02cf00ebaba9dd40caf51c809d65cb0e /src/ast/expr.hpp | |
parent | adc6e7e42f05724d031c50d6d0092753e87cc79d (diff) | |
download | mrust-36e197f903ba19229b35cdd7c5bea045ca34dcdc.tar.gz |
Parse+AST - Support capturing :item (requires cloning AST items)
Diffstat (limited to 'src/ast/expr.hpp')
-rw-r--r-- | src/ast/expr.hpp | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/src/ast/expr.hpp b/src/ast/expr.hpp index 0d503b81..00c1154b 100644 --- a/src/ast/expr.hpp +++ b/src/ast/expr.hpp @@ -40,11 +40,9 @@ public: MetaItems& attrs() { return m_attrs; } TypeRef& get_res_type() { return m_res_type; } - - friend ::std::ostream& operator<<(::std::ostream& os, const ExprNode& node); static ::std::unique_ptr<ExprNode> from_deserialiser(Deserialiser& d); }; -typedef ::std::unique_ptr<AST::ExprNode> ExprNodeP; +typedef ::std::unique_ptr<ExprNode> ExprNodeP; #define NODE_METHODS() \ void visit(NodeVisitor& nv) override;\ @@ -685,33 +683,6 @@ public: #undef NT }; -class Expr -{ - ::std::shared_ptr<ExprNode> m_node; -public: - Expr(unique_ptr<ExprNode> node): - m_node(node.release()) - { - } - Expr(ExprNode* node): - m_node(node) - { - } - Expr(): - m_node(nullptr) - { - } - - bool is_valid() const { return m_node.get() != nullptr; } - ExprNode& node() { assert(m_node.get()); return *m_node; } - const ExprNode& node() const { assert(m_node.get()); return *m_node; } - ::std::shared_ptr<ExprNode> take_node() { assert(m_node.get()); return ::std::move(m_node); } - void visit_nodes(NodeVisitor& v); - void visit_nodes(NodeVisitor& v) const; - - friend ::std::ostream& operator<<(::std::ostream& os, const Expr& pat); -}; - } #endif |