** Ensures final expression result is in some (any) register ** and return that register. */
| 953 | ** and return that register. |
| 954 | */ |
| 955 | int luaK_exp2anyreg (FuncState *fs, expdesc *e) { |
| 956 | luaK_dischargevars(fs, e); |
| 957 | if (e->k == VNONRELOC) { /* expression already has a register? */ |
| 958 | if (!hasjumps(e)) /* no jumps? */ |
| 959 | return e->u.info; /* result is already in a register */ |
| 960 | if (e->u.info >= luaY_nvarstack(fs)) { /* reg. is not a local? */ |
| 961 | exp2reg(fs, e, e->u.info); /* put final result in it */ |
| 962 | return e->u.info; |
| 963 | } |
| 964 | /* else expression has jumps and cannot change its register |
| 965 | to hold the jump values, because it is a local variable. |
| 966 | Go through to the default case. */ |
| 967 | } |
| 968 | luaK_exp2nextreg(fs, e); /* default: use next available register */ |
| 969 | return e->u.info; |
| 970 | } |
| 971 | |
| 972 | |
| 973 | /* |
no test coverage detected