diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-10-28 15:58:07 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-10-28 15:58:07 -0300 |
| commit | 7d526e75a7f45a2593e874d97c7fdfa0e45cc013 (patch) | |
| tree | 7c4e612c2d89f2f2addb336154f9b9bb47f2d760 /lvm.c | |
| parent | c12983cf8afac4c4c757b84aaddab1935a931641 (diff) | |
| download | lua-7d526e75a7f45a2593e874d97c7fdfa0e45cc013.tar.gz lua-7d526e75a7f45a2593e874d97c7fdfa0e45cc013.tar.bz2 lua-7d526e75a7f45a2593e874d97c7fdfa0e45cc013.zip | |
Fixed bug in tail calls of __call chains
A tail call of a __call chain (a __call metamethod that itself is
also not a function) was being perfomed as a regular call.
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 3 |
1 files changed, 2 insertions, 1 deletions
| @@ -1549,9 +1549,10 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1549 | luaF_close(L, base, NOCLOSINGMETH); | 1549 | luaF_close(L, base, NOCLOSINGMETH); |
| 1550 | lua_assert(base == ci->func + 1); | 1550 | lua_assert(base == ci->func + 1); |
| 1551 | } | 1551 | } |
| 1552 | if (!ttisfunction(s2v(ra))) { /* not a function? */ | 1552 | while (!ttisfunction(s2v(ra))) { /* not a function? */ |
| 1553 | luaD_tryfuncTM(L, ra); /* try '__call' metamethod */ | 1553 | luaD_tryfuncTM(L, ra); /* try '__call' metamethod */ |
| 1554 | b++; /* there is now one extra argument */ | 1554 | b++; /* there is now one extra argument */ |
| 1555 | checkstackp(L, 1, ra); | ||
| 1555 | } | 1556 | } |
| 1556 | if (!ttisLclosure(s2v(ra))) { /* C function? */ | 1557 | if (!ttisLclosure(s2v(ra))) { /* C function? */ |
| 1557 | luaD_call(L, ra, LUA_MULTRET); /* call it */ | 1558 | luaD_call(L, ra, LUA_MULTRET); /* call it */ |
