aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-03-21 17:32:22 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-03-21 17:32:22 -0300
commite9ef7ed2d3015ff6083ae51995b153b88837b64d (patch)
tree99e7cfe3682cdbe9de5e4d8728eb98c05b61b8e4 /lparser.c
parent2626708b72f987b62747801443f22953655a2bfc (diff)
downloadlua-e9ef7ed2d3015ff6083ae51995b153b88837b64d.tar.gz
lua-e9ef7ed2d3015ff6083ae51995b153b88837b64d.tar.bz2
lua-e9ef7ed2d3015ff6083ae51995b153b88837b64d.zip
first implementation for tail call
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lparser.c b/lparser.c
index f03475e8..5148267d 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 1.170 2002/03/14 18:32:37 roberto Exp roberto $ 2** $Id: lparser.c,v 1.171 2002/03/18 14:49:46 roberto Exp roberto $
3** Lua Parser 3** Lua Parser
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -1209,6 +1209,10 @@ static void retstat (LexState *ls) {
1209 else { 1209 else {
1210 nret = explist1(ls, &e); /* optional return values */ 1210 nret = explist1(ls, &e); /* optional return values */
1211 if (e.k == VCALL) { 1211 if (e.k == VCALL) {
1212 if (nret == 1) { /* tail call? */
1213 SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
1214 return;
1215 }
1212 luaK_setcallreturns(fs, &e, LUA_MULTRET); 1216 luaK_setcallreturns(fs, &e, LUA_MULTRET);
1213 first = fs->nactloc; 1217 first = fs->nactloc;
1214 nret = LUA_MULTRET; /* return all values */ 1218 nret = LUA_MULTRET; /* return all values */