瀏覽代碼

new implementation for tailcall

Roberto Ierusalimschy 23 年之前
父節點
當前提交
1c0ac3c0f5
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      lparser.c

+ 3 - 3
lparser.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lparser.c,v 1.189 2002/06/26 16:37:13 roberto Exp roberto $
+** $Id: lparser.c,v 1.190 2002/07/04 18:23:42 roberto Exp $
 ** Lua Parser
 ** See Copyright Notice in lua.h
 */
@@ -1166,11 +1166,11 @@ static void retstat (LexState *ls) {
   else {
     nret = explist1(ls, &e);  /* optional return values */
     if (e.k == VCALL) {
+      luaK_setcallreturns(fs, &e, LUA_MULTRET);
       if (nret == 1) {  /* tail call? */
         SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
-        return;
+        lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
       }
-      luaK_setcallreturns(fs, &e, LUA_MULTRET);
       first = fs->nactvar;
       nret = LUA_MULTRET;  /* return all values */
     }