55#include < vector>
66#include < variant>
77
8+ #include " artic/arena.h"
89#include " artic/loc.h"
910#include " artic/log.h"
1011#include " artic/cast.h"
@@ -25,12 +26,8 @@ class TypeChecker;
2526class Emitter ;
2627class Summoner ;
2728
28- template <typename T> using Ptr = std::unique_ptr<T>;
29- template <typename T> using PtrVector = std::vector<std::unique_ptr<T>>;
30- template <typename T, typename ... Args>
31- std::unique_ptr<T> make_ptr (Args&&... args) {
32- return std::make_unique<T>(std::forward<Args>(args)...);
33- }
29+ template <typename T> using Ptr = arena_ptr<T>;
30+ template <typename T> using PtrVector = std::vector<Ptr<T>>;
3431
3532namespace ast {
3633
@@ -155,7 +152,7 @@ struct Ptrn : public Node {
155152 // / Collect patterns that bind an identifier to a value in this pattern.
156153 virtual void collect_bound_ptrns (std::vector<const IdPtrn*>&) const ;
157154 // / Rewrites the pattern into an expression
158- virtual const Expr* to_expr () { return as_expr.get (); }
155+ virtual const Expr* to_expr (Arena& ) { return as_expr.get (); }
159156 // / Returns true when the pattern is trivial (e.g. always matches).
160157 virtual bool is_trivial () const = 0;
161158 // / Emits IR for the pattern, given a value to bind it to.
@@ -1579,7 +1576,7 @@ struct TypedPtrn : public Ptrn {
15791576 void emit (Emitter&, const thorin::Def*) const override ;
15801577 const artic::Type* infer (TypeChecker&) override ;
15811578 void bind (NameBinder&) override ;
1582- const Expr* to_expr () override ;
1579+ const Expr* to_expr (Arena& ) override ;
15831580 void resolve_summons (Summoner&) override ;
15841581 void print (Printer&) const override ;
15851582};
@@ -1600,7 +1597,7 @@ struct IdPtrn : public Ptrn {
16001597 const artic::Type* infer (TypeChecker&) override ;
16011598 const artic::Type* check (TypeChecker&, const artic::Type*) override ;
16021599 void bind (NameBinder&) override ;
1603- const Expr* to_expr () override ;
1600+ const Expr* to_expr (Arena& ) override ;
16041601 void resolve_summons (Summoner&) override ;
16051602 void print (Printer&) const override ;
16061603};
@@ -1618,7 +1615,7 @@ struct LiteralPtrn : public Ptrn {
16181615 const artic::Type* infer (TypeChecker&) override ;
16191616 const artic::Type* check (TypeChecker&, const artic::Type*) override ;
16201617 void bind (NameBinder&) override ;
1621- const Expr* to_expr () override ;
1618+ const Expr* to_expr (Arena& ) override ;
16221619 void resolve_summons (Summoner&) override {};
16231620 void print (Printer&) const override ;
16241621};
0 commit comments