** 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 goto's to this new label and adds ** a close instruction if necessary. ** Returns true iff it added a close instruction. */
| 588 | ** Returns true iff it added a close instruction. |
| 589 | */ |
| 590 | static int createlabel (LexState *ls, TString *name, int line, |
| 591 | int last) { |
| 592 | FuncState *fs = ls->fs; |
| 593 | Labellist *ll = &ls->dyd->label; |
| 594 | int l = newlabelentry(ls, ll, name, line, luaK_getlabel(fs)); |
| 595 | if (last) { /* label is last no-op statement in the block? */ |
| 596 | /* assume that locals are already out of scope */ |
| 597 | ll->arr[l].nactvar = fs->bl->nactvar; |
| 598 | } |
| 599 | if (solvegotos(ls, &ll->arr[l])) { /* need close? */ |
| 600 | luaK_codeABC(fs, OP_CLOSE, luaY_nvarstack(fs), 0, 0); |
| 601 | return 1; |
| 602 | } |
| 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | |
| 607 | /* |
no test coverage detected