diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-11-06 10:43:51 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-11-06 10:43:51 -0200 |
commit | b47209849321b17e2037bfa46abf530e69bcc869 (patch) | |
tree | 1915a213b71e70c7cdbc405b260ccdef48bedf21 /lvm.c | |
parent | 84b3daebbd09b334db0fa125700ffdb1d326c4f6 (diff) | |
download | lua-b47209849321b17e2037bfa46abf530e69bcc869.tar.gz lua-b47209849321b17e2037bfa46abf530e69bcc869.tar.bz2 lua-b47209849321b17e2037bfa46abf530e69bcc869.zip |
concat TM can yield
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.78 2008/10/28 16:53:16 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.79 2008/10/30 15:39:30 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -271,8 +271,10 @@ void luaV_concat (lua_State *L, int total, int last) { | |||
271 | StkId top = L->base + last + 1; | 271 | StkId top = L->base + last + 1; |
272 | int n = 2; /* number of elements handled in this pass (at least 2) */ | 272 | int n = 2; /* number of elements handled in this pass (at least 2) */ |
273 | if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { | 273 | if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { |
274 | L->top = top; /* set top to current position (in case of yield) */ | ||
274 | if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) | 275 | if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) |
275 | luaG_concaterror(L, top-2, top-1); | 276 | luaG_concaterror(L, top-2, top-1); |
277 | L->top = L->ci->top; /* restore top */ | ||
276 | } | 278 | } |
277 | else if (tsvalue(top-1)->len == 0) { /* second operand is empty? */ | 279 | else if (tsvalue(top-1)->len == 0) { /* second operand is empty? */ |
278 | (void)tostring(L, top - 2); /* result is first operand */ ; | 280 | (void)tostring(L, top - 2); /* result is first operand */ ; |