fix(library/kernel_bindings): Lua API consistency, environment:add method also register declaration in the export table

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-05-31 12:20:57 -07:00
parent 7bd10c2d2d
commit 75abcea83f

View file

@ -1110,9 +1110,9 @@ static int environment_find(lua_State * L) { return push_optional_declaration(L,
static int environment_get(lua_State * L) { return push_declaration(L, to_environment(L, 1).get(to_name_ext(L, 2))); } static int environment_get(lua_State * L) { return push_declaration(L, to_environment(L, 1).get(to_name_ext(L, 2))); }
static int environment_add(lua_State * L) { static int environment_add(lua_State * L) {
if (is_declaration(L, 2)) if (is_declaration(L, 2))
return push_environment(L, to_environment(L, 1).add(to_declaration(L, 2))); return push_environment(L, module::add(to_environment(L, 1), to_declaration(L, 2)));
else else
return push_environment(L, to_environment(L, 1).add(to_certified_declaration(L, 2))); return push_environment(L, module::add(to_environment(L, 1), to_certified_declaration(L, 2)));
} }
static int environment_replace(lua_State * L) { return push_environment(L, to_environment(L, 1).replace(to_certified_declaration(L, 2))); } static int environment_replace(lua_State * L) { return push_environment(L, to_environment(L, 1).replace(to_certified_declaration(L, 2))); }
static int mk_bare_environment(lua_State * L) { static int mk_bare_environment(lua_State * L) {