diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-01-10 17:19:27 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-01-10 17:19:27 -0200 |
commit | ab0a851db438c4dd50b76bcf624c15623cc057e4 (patch) | |
tree | da55c14dffd959fc38351fc43dcb0fcb294077cb /lvm.c | |
parent | 728ff9459579894ef7fd861c90be6247831799be (diff) | |
download | lua-ab0a851db438c4dd50b76bcf624c15623cc057e4.tar.gz lua-ab0a851db438c4dd50b76bcf624c15623cc057e4.tar.bz2 lua-ab0a851db438c4dd50b76bcf624c15623cc057e4.zip |
'luaD_tryfuncTM' can ensure it does not change the stack
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.331 2017/12/30 20:46:18 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.332 2018/01/09 14:23:40 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 | */ |
@@ -1501,9 +1501,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1501 | b = L->top - ra; | 1501 | b = L->top - ra; |
1502 | lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); | 1502 | lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); |
1503 | if (!ttisfunction(vra)) { /* not a function? */ | 1503 | if (!ttisfunction(vra)) { /* not a function? */ |
1504 | /* try to get '__call' metamethod */ | 1504 | ProtectNT(luaD_tryfuncTM(L, ra)); /* try '__call' metamethod */ |
1505 | ProtectNT(ra = luaD_tryfuncTM(L, ra)); | ||
1506 | vra = s2v(ra); | ||
1507 | b++; /* there is now one extra argument */ | 1505 | b++; /* there is now one extra argument */ |
1508 | } | 1506 | } |
1509 | if (!ttisLclosure(vra)) { /* C function? */ | 1507 | if (!ttisLclosure(vra)) { /* C function? */ |