예제 #1
0
파일: lparser.c 프로젝트: 1nv1/wxlua
static void closelistfield (FuncState *fs, struct ConsControl *cc) {
  if (cc->v.k == VVOID) return;  /* there is no list item */
  luaK_exp2nextreg(fs, &cc->v);
  cc->v.k = VVOID;
  if (cc->tostore == LFIELDS_PER_FLUSH) {
    luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore);  /* flush */
    cc->tostore = 0;  /* no more items pending */
  }
}
예제 #2
0
static void lastlistfield (FuncState *fs, struct ConsControl *cc)
{
    if (cc->tostore == 0)
    {
        return;
    }

    if (hasmultret(cc->v.k))
    {
        luaK_setmultret(fs, &cc->v);
        luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET);

        cc->na--;  /* do not count last expression (unknown number of elements) */
    }
    else
    {
        if (cc->v.k != VVOID)
        {
            luaK_exp2nextreg(fs, &cc->v);
        }

        luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore);
    }
}