diff options
| -rw-r--r-- | ldo.c | 17 |
1 files changed, 5 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 1.185 2002/07/04 12:29:32 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.186 2002/07/08 18:21:33 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -125,16 +125,6 @@ static void luaD_growCI (lua_State *L) { | |||
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | 127 | ||
| 128 | /* | ||
| 129 | ** Open a hole inside the stack at `pos' | ||
| 130 | */ | ||
| 131 | static void luaD_openstack (lua_State *L, StkId pos) { | ||
| 132 | StkId p; | ||
| 133 | for (p = L->top; p > pos; p--) setobj(p, p-1); | ||
| 134 | incr_top(L); | ||
| 135 | } | ||
| 136 | |||
| 137 | |||
| 138 | void luaD_callhook (lua_State *L, lua_Hookevent event, int line) { | 128 | void luaD_callhook (lua_State *L, lua_Hookevent event, int line) { |
| 139 | lua_Hook hook = L->hook; | 129 | lua_Hook hook = L->hook; |
| 140 | if (hook && allowhook(L)) { | 130 | if (hook && allowhook(L)) { |
| @@ -187,11 +177,14 @@ static void adjust_varargs (lua_State *L, int nfixargs) { | |||
| 187 | 177 | ||
| 188 | static StkId tryfuncTM (lua_State *L, StkId func) { | 178 | static StkId tryfuncTM (lua_State *L, StkId func) { |
| 189 | const TObject *tm = luaT_gettmbyobj(L, func, TM_CALL); | 179 | const TObject *tm = luaT_gettmbyobj(L, func, TM_CALL); |
| 180 | StkId p; | ||
| 190 | if (ttype(tm) != LUA_TFUNCTION) { | 181 | if (ttype(tm) != LUA_TFUNCTION) { |
| 191 | L->ci--; /* undo increment (no function here) */ | 182 | L->ci--; /* undo increment (no function here) */ |
| 192 | luaG_typeerror(L, func, "call"); | 183 | luaG_typeerror(L, func, "call"); |
| 193 | } | 184 | } |
| 194 | luaD_openstack(L, func); | 185 | /* Open a hole inside the stack at `func' */ |
| 186 | for (p = L->top; p > func; p--) setobj(p, p-1); | ||
| 187 | incr_top(L); | ||
| 195 | func = L->ci->base - 1; /* previous call may change stack */ | 188 | func = L->ci->base - 1; /* previous call may change stack */ |
| 196 | setobj(func, tm); /* tag method is the new function to be called */ | 189 | setobj(func, tm); /* tag method is the new function to be called */ |
| 197 | return func; | 190 | return func; |
