diff options
Diffstat (limited to 'src/hir/expr_ptr.cpp')
-rw-r--r-- | src/hir/expr_ptr.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/hir/expr_ptr.cpp b/src/hir/expr_ptr.cpp index fcef34bd..7f493a0d 100644 --- a/src/hir/expr_ptr.cpp +++ b/src/hir/expr_ptr.cpp @@ -45,6 +45,13 @@ } +const Span& HIR::ExprPtr::span() const +{ + static Span static_sp; + if( *this ) + return (*this)->span(); + return static_sp; +} const ::MIR::Function* HIR::ExprPtr::get_mir_opt() const { if(!this->m_mir) @@ -83,6 +90,15 @@ void HIR::ExprPtr::set_mir(::MIR::FunctionPointer mir) { assert( !this->m_mir ); m_mir = ::std::move(mir); + // Reset the HIR tree to be a placeholder node (thus freeing the backing memory) + if( false && node ) + { + auto sp = node->span(); + node = ExprPtrInner(::std::unique_ptr<HIR::ExprNode>(new ::HIR::ExprNode_Loop( + sp, "", + ::std::unique_ptr<HIR::ExprNode>(new ::HIR::ExprNode_Tuple(sp, {})) + ))); + } } |