diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-06 17:30:53 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-06 17:30:53 -0200 |
| commit | ba1f504970daf205ddb8f7a6b33474ee5fa1f64b (patch) | |
| tree | b522454fa8ecc5c09b3adac001a40acf55b2859e | |
| parent | 617be660158490c7f6558e82d9be2c667c48d9a4 (diff) | |
| download | lua-ba1f504970daf205ddb8f7a6b33474ee5fa1f64b.tar.gz lua-ba1f504970daf205ddb8f7a6b33474ee5fa1f64b.tar.bz2 lua-ba1f504970daf205ddb8f7a6b33474ee5fa1f64b.zip | |
`optimization' doesn't seem to make any difference...
| -rw-r--r-- | lvm.c | 26 |
1 files changed, 10 insertions, 16 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.69 1999/12/01 19:50:08 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.70 1999/12/06 11:40:55 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -170,21 +170,15 @@ void luaV_rawsettable (lua_State *L, StkId t) { | |||
| 170 | void luaV_getglobal (lua_State *L, GlobalVar *gv) { | 170 | void luaV_getglobal (lua_State *L, GlobalVar *gv) { |
| 171 | /* WARNING: caller must assure stack space */ | 171 | /* WARNING: caller must assure stack space */ |
| 172 | const TObject *value = &gv->value; | 172 | const TObject *value = &gv->value; |
| 173 | switch (ttype(value)) { | 173 | TObject *im = luaT_getimbyObj(L, value, IM_GETGLOBAL); |
| 174 | /* only userdata, tables and nil can have getglobal tag methods */ | 174 | if (ttype(im) != LUA_T_NIL) { /* is there a tag method? */ |
| 175 | case LUA_T_USERDATA: case LUA_T_ARRAY: case LUA_T_NIL: { | 175 | ttype(L->top) = LUA_T_STRING; |
| 176 | TObject *im = luaT_getimbyObj(L, value, IM_GETGLOBAL); | 176 | tsvalue(L->top) = gv->name; /* global name */ |
| 177 | if (ttype(im) != LUA_T_NIL) { /* is there a tag method? */ | 177 | L->top++; |
| 178 | ttype(L->top) = LUA_T_STRING; | 178 | *L->top++ = *value; |
| 179 | tsvalue(L->top) = gv->name; /* global name */ | 179 | luaD_callTM(L, im, 2, 1); |
| 180 | L->top++; | 180 | } else { /* no tag method */ |
| 181 | *L->top++ = *value; | 181 | *L->top++ = *value; /* default behavior */ |
| 182 | luaD_callTM(L, im, 2, 1); | ||
| 183 | return; | ||
| 184 | } | ||
| 185 | /* else no tag method: go through to default behavior */ | ||
| 186 | } | ||
| 187 | default: *L->top++ = *value; /* default behavior */ | ||
| 188 | } | 182 | } |
| 189 | } | 183 | } |
| 190 | 184 | ||
