[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Small bug in luac/print.c
- From: Edgar Toernig <froese@...>
- Date: Tue, 17 Oct 2000 21:25:50 +0200
Hi,
This program
do local z end
local a
a=1
generates this output with luac -l
1 PUSHNIL 1
2 POP 1
3 PUSHNIL 1
4 PUSHINT 1
5 SETLOCAL 0 ; z
6 END
Note the 'z'. It should be an 'a'. I think this patch fixes that.
--- lua-4b-orig/src/luac/print.c Tue Sep 19 21:46:12 2000
+++ lua-4b/src/luac/print.c Tue Oct 17 19:37:38 2000
@@ -20,12 +20,13 @@
#define P_J printf("%d\t; to %d", GETARG_S(i),GETARG_S(i)+at+1)
#define P_N printf("%d\t; %g", GETARG_U(i),tf->knum[GETARG_U(i)])
#define P_F printf("%d %d\t; %p", GETARG_A(i), GETARG_B(i),tf->kproto[GETARG_A(i)])
-#define P_L printf("%u\t; %s", GETARG_U(i), tf->locvars ? tf->locvars[GETARG_U(i)].varname->str : "")
+#define P_L printf("%u\t; %s", GETARG_U(i), (cp = luaF_getlocalname(tf, GETARG_U(i)+1, p-code)) ? cp : "?")
#define P_LB P_AB
#define P_sAL printf("%d %d", GETARG_sA(i), GETARG_B(i))
static void PrintCode(const Proto* tf)
{
+ const char *cp;
const Instruction* code=tf->code;
const Instruction* p=code;
for (;;)
Ciao, ET.