aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/ltests.c b/ltests.c
index 33266f38..7b4c0e17 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.123 2011/09/24 21:11:29 roberto Exp roberto $ 2** $Id: ltests.c,v 2.124 2011/11/09 19:08:07 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -267,22 +267,23 @@ static void checkproto (global_State *g, Proto *f) {
267 267
268 268
269 269
270static void checkclosure (global_State *g, Closure *cl) { 270static void checkCclosure (global_State *g, CClosure *cl) {
271 GCObject *clgc = obj2gco(cl); 271 GCObject *clgc = obj2gco(cl);
272 if (cl->c.isC) { 272 int i;
273 int i; 273 for (i = 0; i < cl->nupvalues; i++)
274 for (i=0; i<cl->c.nupvalues; i++) 274 checkvalref(g, clgc, &cl->upvalue[i]);
275 checkvalref(g, clgc, &cl->c.upvalue[i]); 275}
276 } 276
277 else { 277
278 int i; 278static void checkLclosure (global_State *g, LClosure *cl) {
279 lua_assert(cl->l.nupvalues == cl->l.p->sizeupvalues); 279 GCObject *clgc = obj2gco(cl);
280 checkobjref(g, clgc, cl->l.p); 280 int i;
281 for (i=0; i<cl->l.nupvalues; i++) { 281 lua_assert(cl->nupvalues == cl->p->sizeupvalues);
282 if (cl->l.upvals[i]) { 282 checkobjref(g, clgc, cl->p);
283 lua_assert(cl->l.upvals[i]->tt == LUA_TUPVAL); 283 for (i=0; i<cl->nupvalues; i++) {
284 checkobjref(g, clgc, cl->l.upvals[i]); 284 if (cl->upvals[i]) {
285 } 285 lua_assert(cl->upvals[i]->tt == LUA_TUPVAL);
286 checkobjref(g, clgc, cl->upvals[i]);
286 } 287 }
287 } 288 }
288} 289}
@@ -347,8 +348,12 @@ static void checkobject (global_State *g, GCObject *o) {
347 checkstack(g, gco2th(o)); 348 checkstack(g, gco2th(o));
348 break; 349 break;
349 } 350 }
350 case LUA_TFUNCTION: { 351 case LUA_TLCL: {
351 checkclosure(g, gco2cl(o)); 352 checkLclosure(g, gco2lcl(o));
353 break;
354 }
355 case LUA_TCCL: {
356 checkCclosure(g, gco2ccl(o));
352 break; 357 break;
353 } 358 }
354 case LUA_TPROTO: { 359 case LUA_TPROTO: {