| 590 | |
| 591 | |
| 592 | void luaK_storevar(FuncState *fs, expdesc *var, expdesc *ex) { |
| 593 | switch (var->k) { |
| 594 | case VLOCAL: { |
| 595 | freeexp(fs, ex); |
| 596 | exp2reg(fs, ex, var->u.info); |
| 597 | return; |
| 598 | } |
| 599 | case VUPVAL: { |
| 600 | int e = luaK_exp2anyreg(fs, ex); |
| 601 | luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0); |
| 602 | break; |
| 603 | } |
| 604 | case VINDEXED: { |
| 605 | OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP; |
| 606 | int e = luaK_exp2RK(fs, ex); |
| 607 | luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e); |
| 608 | break; |
| 609 | } |
| 610 | default: { |
| 611 | lua_assert(0); /* invalid var kind to store */ |
| 612 | break; |
| 613 | } |
| 614 | } |
| 615 | freeexp(fs, ex); |
| 616 | } |
| 617 | |
| 618 | |
| 619 | void luaK_self(FuncState *fs, expdesc *e, expdesc *key) { |
no test coverage detected