fix(frontends/lean): must invoke lua GC before closing a scope, reason: we may still have references to the current environment inside of the Lua state object

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-01-05 16:38:29 -08:00
parent 9d6bd7501c
commit 771b099c0c

View file

@ -733,6 +733,7 @@ void parser_imp::parse_end() {
throw parser_error("invalid 'end', not inside of a scope or namespace", m_last_cmd_pos);
scope_kind k = m_scope_kinds.back();
m_scope_kinds.pop_back();
m_script_state->apply([&](lua_State * L) { lua_gc(L, LUA_GCCOLLECT, LUA_TUSERDATA); });
switch (k) {
case scope_kind::Scope: {
if (!m_env->has_parent())