aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lvm.c10
-rw-r--r--testes/errors.lua4
-rw-r--r--testes/utf8.lua2
3 files changed, 11 insertions, 5 deletions
diff --git a/lvm.c b/lvm.c
index d0358143..45788a01 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1556,20 +1556,22 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
1556 L->top = ra + b; 1556 L->top = ra + b;
1557 else /* previous instruction set top */ 1557 else /* previous instruction set top */
1558 b = cast_int(L->top - ra); 1558 b = cast_int(L->top - ra);
1559 savepc(ci); /* some calls here can raise errors */
1559 if (TESTARG_k(i)) { 1560 if (TESTARG_k(i)) {
1560 int nparams1 = GETARG_C(i); 1561 int nparams1 = GETARG_C(i);
1561 if (nparams1) /* vararg function? */ 1562 if (nparams1) /* vararg function? */
1562 delta = ci->u.l.nextraargs + nparams1; 1563 delta = ci->u.l.nextraargs + nparams1;
1563 /* close upvalues from current call */ 1564 /* close upvalues from current call; the compiler ensures
1564 luaF_close(L, base, LUA_OK); 1565 that there are no to-be-closed variables here */
1565 updatestack(ci); 1566 luaF_close(L, base, NOCLOSINGMETH);
1566 } 1567 }
1567 if (!ttisfunction(s2v(ra))) { /* not a function? */ 1568 if (!ttisfunction(s2v(ra))) { /* not a function? */
1568 luaD_tryfuncTM(L, ra); /* try '__call' metamethod */ 1569 luaD_tryfuncTM(L, ra); /* try '__call' metamethod */
1569 b++; /* there is now one extra argument */ 1570 b++; /* there is now one extra argument */
1570 } 1571 }
1571 if (!ttisLclosure(s2v(ra))) { /* C function? */ 1572 if (!ttisLclosure(s2v(ra))) { /* C function? */
1572 ProtectNT(luaD_call(L, ra, LUA_MULTRET)); /* call it */ 1573 luaD_call(L, ra, LUA_MULTRET); /* call it */
1574 updatetrap(ci);
1573 updatestack(ci); /* stack may have been relocated */ 1575 updatestack(ci); /* stack may have been relocated */
1574 ci->func -= delta; 1576 ci->func -= delta;
1575 luaD_poscall(L, ci, cast_int(L->top - ra)); 1577 luaD_poscall(L, ci, cast_int(L->top - ra));
diff --git a/testes/errors.lua b/testes/errors.lua
index 74975e31..0b12410e 100644
--- a/testes/errors.lua
+++ b/testes/errors.lua
@@ -99,6 +99,10 @@ assert(not string.find(doit"a={13}; local bbbb=1; a[bbbb](3)", "'bbbb'"))
99checkmessage("a={13}; local bbbb=1; a[bbbb](3)", "number") 99checkmessage("a={13}; local bbbb=1; a[bbbb](3)", "number")
100checkmessage("a=(1)..{}", "a table value") 100checkmessage("a=(1)..{}", "a table value")
101 101
102-- tail calls
103checkmessage("local a={}; return a.bbbb(3)", "field 'bbbb'")
104checkmessage("a={}; do local a=1 end; return a:bbbb(3)", "method 'bbbb'")
105
102checkmessage("a = #print", "length of a function value") 106checkmessage("a = #print", "length of a function value")
103checkmessage("a = #3", "length of a number value") 107checkmessage("a = #3", "length of a number value")
104 108
diff --git a/testes/utf8.lua b/testes/utf8.lua
index b3b7687f..acbb181d 100644
--- a/testes/utf8.lua
+++ b/testes/utf8.lua
@@ -66,7 +66,7 @@ local function check (s, t, nonstrict)
66 assert(utf8.len(s, pi, pi1 - 1, nonstrict) == 1) 66 assert(utf8.len(s, pi, pi1 - 1, nonstrict) == 1)
67 assert(utf8.len(s, pi, -1, nonstrict) == l - i + 1) 67 assert(utf8.len(s, pi, -1, nonstrict) == l - i + 1)
68 assert(utf8.len(s, pi1, -1, nonstrict) == l - i) 68 assert(utf8.len(s, pi1, -1, nonstrict) == l - i)
69 assert(utf8.len(s, 1, pi, -1, nonstrict) == i) 69 assert(utf8.len(s, 1, pi, nonstrict) == i)
70 end 70 end
71 71
72 local i = 0 72 local i = 0