aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-05-13 10:04:33 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-05-13 10:04:33 -0300
commit5c8770f8969a73cf4ca503f54c2217f76de62e04 (patch)
treed5dac87490011d117277d94c81f6f2fd47b1b094 /ldebug.c
parent7647d5d13d016f114dac4be0b9da62d502eab400 (diff)
downloadlua-5c8770f8969a73cf4ca503f54c2217f76de62e04.tar.gz
lua-5c8770f8969a73cf4ca503f54c2217f76de62e04.tar.bz2
lua-5c8770f8969a73cf4ca503f54c2217f76de62e04.zip
back to old-style vararg system (with vararg table collecting extra
arguments)
Diffstat (limited to '')
-rw-r--r--ldebug.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/ldebug.c b/ldebug.c
index ead16794..776b05eb 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 2.123 2017/04/28 20:57:45 roberto Exp roberto $ 2** $Id: ldebug.c,v 2.124 2017/04/29 15:28:38 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -131,28 +131,13 @@ static const char *upvalname (Proto *p, int uv) {
131} 131}
132 132
133 133
134static const char *findvararg (CallInfo *ci, int n, StkId *pos) {
135 int nparams = clLvalue(ci->func)->p->numparams;
136 if (n >= cast_int(ci->u.l.base - ci->func) - nparams)
137 return NULL; /* no such vararg */
138 else {
139 *pos = ci->func + nparams + n;
140 return "(*vararg)"; /* generic name for any vararg */
141 }
142}
143
144
145static const char *findlocal (lua_State *L, CallInfo *ci, int n, 134static const char *findlocal (lua_State *L, CallInfo *ci, int n,
146 StkId *pos) { 135 StkId *pos) {
147 const char *name = NULL; 136 const char *name = NULL;
148 StkId base; 137 StkId base;
149 if (isLua(ci)) { 138 if (isLua(ci)) {
150 if (n < 0) /* access to vararg values? */ 139 base = ci->u.l.base;
151 return findvararg(ci, -n, pos); 140 name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
152 else {
153 base = ci->u.l.base;
154 name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
155 }
156 } 141 }
157 else 142 else
158 base = ci->func + 1; 143 base = ci->func + 1;