diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-05 14:35:45 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-05 14:35:45 -0300 |
commit | 1c0ac3c0f53720c53dcfae13308b11b29dca38e4 (patch) | |
tree | 7980ba5cced975e27960a10d4e479cd473172359 | |
parent | 4a4f2437952e0968c010ea3424c3c1c3df2188c1 (diff) | |
download | lua-1c0ac3c0f53720c53dcfae13308b11b29dca38e4.tar.gz lua-1c0ac3c0f53720c53dcfae13308b11b29dca38e4.tar.bz2 lua-1c0ac3c0f53720c53dcfae13308b11b29dca38e4.zip |
new implementation for tailcall
-rw-r--r-- | lparser.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.189 2002/06/26 16:37:13 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.190 2002/07/04 18:23:42 roberto Exp $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1166,11 +1166,11 @@ static void retstat (LexState *ls) { | |||
1166 | else { | 1166 | else { |
1167 | nret = explist1(ls, &e); /* optional return values */ | 1167 | nret = explist1(ls, &e); /* optional return values */ |
1168 | if (e.k == VCALL) { | 1168 | if (e.k == VCALL) { |
1169 | luaK_setcallreturns(fs, &e, LUA_MULTRET); | ||
1169 | if (nret == 1) { /* tail call? */ | 1170 | if (nret == 1) { /* tail call? */ |
1170 | SET_OPCODE(getcode(fs,&e), OP_TAILCALL); | 1171 | SET_OPCODE(getcode(fs,&e), OP_TAILCALL); |
1171 | return; | 1172 | lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); |
1172 | } | 1173 | } |
1173 | luaK_setcallreturns(fs, &e, LUA_MULTRET); | ||
1174 | first = fs->nactvar; | 1174 | first = fs->nactvar; |
1175 | nret = LUA_MULTRET; /* return all values */ | 1175 | nret = LUA_MULTRET; /* return all values */ |
1176 | } | 1176 | } |