** Ensures final expression result is in some (any) register ** and return that register. */
| 934 | ** and return that register. |
| 935 | */ |
| 936 | int luaK_exp2anyreg (FuncState *fs, expdesc *e) { |
| 937 | luaK_dischargevars(fs, e); |
| 938 | if (e->k == VNONRELOC) { /* expression already has a register? */ |
| 939 | if (!hasjumps(e)) /* no jumps? */ |
| 940 | return e->u.info; /* result is already in a register */ |
| 941 | if (e->u.info >= luaY_nvarstack(fs)) { /* reg. is not a local? */ |
| 942 | exp2reg(fs, e, e->u.info); /* put final result in it */ |
| 943 | return e->u.info; |
| 944 | } |
| 945 | /* else expression has jumps and cannot change its register |
| 946 | to hold the jump values, because it is a local variable. |
| 947 | Go through to the default case. */ |
| 948 | } |
| 949 | luaK_exp2nextreg(fs, e); /* default: use next available register */ |
| 950 | return e->u.info; |
| 951 | } |
| 952 | |
| 953 | |
| 954 | /* |
no test coverage detected