** Create a new label with the given 'name' at the given 'line'. ** 'last' tells whether label is the last non-op statement in its ** block. Solves all pending gotos to this new label and adds ** a close instruction if necessary. ** Returns true iff it added a close instruction. */
| 606 | ** Returns true iff it added a close instruction. |
| 607 | */ |
| 608 | static int createlabel (LexState *ls, TString *name, int line, |
| 609 | int last) { |
| 610 | FuncState *fs = ls->fs; |
| 611 | Labellist *ll = &ls->dyd->label; |
| 612 | int l = newlabelentry(ls, ll, name, line, luaK_getlabel(fs)); |
| 613 | if (last) { /* label is last no-op statement in the block? */ |
| 614 | /* assume that locals are already out of scope */ |
| 615 | ll->arr[l].nactvar = fs->bl->nactvar; |
| 616 | } |
| 617 | if (solvegotos(ls, &ll->arr[l])) { /* need close? */ |
| 618 | luaK_codeABC(fs, OP_CLOSE, luaY_nvarstack(fs), 0, 0); |
| 619 | return 1; |
| 620 | } |
| 621 | return 0; |
| 622 | } |
| 623 | |
| 624 | |
| 625 | /* |
no test coverage detected