kakoune

Fork of kakoune, an acceptable text editor
git clone git://git.laack.co/kakoune.git
Log | Files | Refs

local_scope.hh (558B)


      1 #ifndef local_scope_hh_INCLUDED
      2 #define local_scope_hh_INCLUDED
      3 
      4 #include "scope.hh"
      5 #include "context.hh"
      6 
      7 namespace Kakoune
      8 {
      9 
     10 struct LocalScope : Scope
     11 {
     12     LocalScope(Context& context)
     13         : Scope(context.scope()), m_context{context}
     14     {
     15         m_context.m_local_scopes.push_back(this);
     16     }
     17 
     18     ~LocalScope()
     19     {
     20         kak_assert(not m_context.m_local_scopes.empty() and m_context.m_local_scopes.back() == this);
     21         m_context.m_local_scopes.pop_back();
     22     }
     23 
     24 private:
     25     Context& m_context;
     26 };
     27 
     28 }
     29 
     30 #endif // local_scope_hh_INCLUDED