fix(library/tmp_type_context): initialization

This commit is contained in:
Leonardo de Moura 2015-11-01 11:17:44 -08:00
parent a26ea2a249
commit 87ec7383dd
3 changed files with 24 additions and 0 deletions

View file

@ -45,6 +45,7 @@ Author: Leonardo de Moura
#include "library/norm_num.h" #include "library/norm_num.h"
#include "library/class_instance_resolution.h" #include "library/class_instance_resolution.h"
#include "library/type_context.h" #include "library/type_context.h"
#include "library/tmp_type_context.h"
namespace lean { namespace lean {
void initialize_library_module() { void initialize_library_module() {
@ -89,9 +90,11 @@ void initialize_library_module() {
initialize_norm_num(); initialize_norm_num();
initialize_class_instance_resolution(); initialize_class_instance_resolution();
initialize_type_context(); initialize_type_context();
initialize_tmp_type_context();
} }
void finalize_library_module() { void finalize_library_module() {
finalize_tmp_type_context();
finalize_type_context(); finalize_type_context();
finalize_class_instance_resolution(); finalize_class_instance_resolution();
finalize_norm_num(); finalize_norm_num();

View file

@ -152,4 +152,12 @@ void tmp_type_context::commit() {
lean_assert(!m_scopes.empty()); lean_assert(!m_scopes.empty());
m_scopes.pop_back(); m_scopes.pop_back();
} }
void initialize_tmp_type_context() {
g_prefix = new name(name::mk_internal_unique_name());
}
void finalize_tmp_type_context() {
delete g_prefix;
}
} }

View file

@ -80,5 +80,18 @@ public:
virtual void push(); virtual void push();
virtual void pop(); virtual void pop();
virtual void commit(); virtual void commit();
bool is_uvar_assigned(unsigned idx) const {
lean_assert(idx < m_uassignment.size());
return static_cast<bool>(m_uassignment[idx]);
}
bool is_mvar_assigned(unsigned idx) const {
lean_assert(idx < m_eassignment.size());
return static_cast<bool>(m_eassignment[idx]);
}
}; };
void initialize_tmp_type_context();
void finalize_tmp_type_context();
} }