no more 'Proto' objects on the stack. Protos are anchored on outer

Protos or on a Closure, which must be created before the Proto.
This commit is contained in:
Roberto Ierusalimschy
2012-05-08 10:53:33 -03:00
parent bb1146dc39
commit 3cadc37f47
11 changed files with 103 additions and 90 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lfunc.c,v 2.27 2010/06/30 14:11:17 roberto Exp roberto $
** $Id: lfunc.c,v 2.28 2012/01/20 22:05:50 roberto Exp roberto $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/
@@ -27,10 +27,9 @@ Closure *luaF_newCclosure (lua_State *L, int n) {
}
Closure *luaF_newLclosure (lua_State *L, Proto *p) {
int n = p->sizeupvalues;
Closure *luaF_newLclosure (lua_State *L, int n) {
Closure *c = &luaC_newobj(L, LUA_TLCL, sizeLclosure(n), NULL, 0)->cl;
c->l.p = p;
c->l.p = NULL;
c->l.nupvalues = cast_byte(n);
while (n--) c->l.upvals[n] = NULL;
return c;