diff options
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 13 |
1 files changed, 8 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 2.87 2011/10/07 20:45:19 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.88 2011/11/30 12:43:51 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -30,6 +30,9 @@ | |||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | #define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_TCCL) | ||
| 34 | |||
| 35 | |||
| 33 | static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); | 36 | static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); |
| 34 | 37 | ||
| 35 | 38 | ||
| @@ -173,7 +176,7 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { | |||
| 173 | 176 | ||
| 174 | 177 | ||
| 175 | static void funcinfo (lua_Debug *ar, Closure *cl) { | 178 | static void funcinfo (lua_Debug *ar, Closure *cl) { |
| 176 | if (cl == NULL || cl->c.isC) { | 179 | if (noLuaClosure(cl)) { |
| 177 | ar->source = "=[C]"; | 180 | ar->source = "=[C]"; |
| 178 | ar->linedefined = -1; | 181 | ar->linedefined = -1; |
| 179 | ar->lastlinedefined = -1; | 182 | ar->lastlinedefined = -1; |
| @@ -191,7 +194,7 @@ static void funcinfo (lua_Debug *ar, Closure *cl) { | |||
| 191 | 194 | ||
| 192 | 195 | ||
| 193 | static void collectvalidlines (lua_State *L, Closure *f) { | 196 | static void collectvalidlines (lua_State *L, Closure *f) { |
| 194 | if (f == NULL || f->c.isC) { | 197 | if (noLuaClosure(f)) { |
| 195 | setnilvalue(L->top); | 198 | setnilvalue(L->top); |
| 196 | incr_top(L); | 199 | incr_top(L); |
| 197 | } | 200 | } |
| @@ -210,7 +213,7 @@ static void collectvalidlines (lua_State *L, Closure *f) { | |||
| 210 | 213 | ||
| 211 | 214 | ||
| 212 | static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, | 215 | static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, |
| 213 | Closure *f, CallInfo *ci) { | 216 | Closure *f, CallInfo *ci) { |
| 214 | int status = 1; | 217 | int status = 1; |
| 215 | for (; *what; what++) { | 218 | for (; *what; what++) { |
| 216 | switch (*what) { | 219 | switch (*what) { |
| @@ -224,7 +227,7 @@ static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, | |||
| 224 | } | 227 | } |
| 225 | case 'u': { | 228 | case 'u': { |
| 226 | ar->nups = (f == NULL) ? 0 : f->c.nupvalues; | 229 | ar->nups = (f == NULL) ? 0 : f->c.nupvalues; |
| 227 | if (f == NULL || f->c.isC) { | 230 | if (noLuaClosure(f)) { |
| 228 | ar->isvararg = 1; | 231 | ar->isvararg = 1; |
| 229 | ar->nparams = 0; | 232 | ar->nparams = 0; |
| 230 | } | 233 | } |
