| 524 | |
| 525 | |
| 526 | int luaK_exp2RK (FuncState *fs, expdesc *e) { |
| 527 | luaK_exp2val(fs, e); |
| 528 | switch (e->k) { |
| 529 | case VTRUE: |
| 530 | case VFALSE: |
| 531 | case VNIL: { |
| 532 | if (fs->nk <= MAXINDEXRK) { /* constant fits in RK operand? */ |
| 533 | e->u.info = (e->k == VNIL) ? nilK(fs) : boolK(fs, (e->k == VTRUE)); |
| 534 | e->k = VK; |
| 535 | return RKASK(e->u.info); |
| 536 | } |
| 537 | else break; |
| 538 | } |
| 539 | case VKNUM: { |
| 540 | e->u.info = luaK_numberK(fs, e->u.nval); |
| 541 | e->k = VK; |
| 542 | /* go through */ |
| 543 | } |
| 544 | case VK: { |
| 545 | if (e->u.info <= MAXINDEXRK) /* constant fits in argC? */ |
| 546 | return RKASK(e->u.info); |
| 547 | else break; |
| 548 | } |
| 549 | default: break; |
| 550 | } |
| 551 | /* not a constant in the right range: put it in a register */ |
| 552 | return luaK_exp2anyreg(fs, e); |
| 553 | } |
| 554 | |
| 555 | |
| 556 | void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { |
no test coverage detected