| 645 | |
| 646 | |
| 647 | static void recfield (LexState *ls, struct ConsControl *cc) { |
| 648 | /* recfield -> (NAME | '['exp1']') = exp1 */ |
| 649 | FuncState *fs = ls->fs; |
| 650 | int reg = ls->fs->freereg; |
| 651 | expdesc key, val; |
| 652 | int rkkey; |
| 653 | if (ls->t.token == TK_NAME) { |
| 654 | checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); |
| 655 | checkname(ls, &key); |
| 656 | } |
| 657 | else /* ls->t.token == '[' */ |
| 658 | yindex(ls, &key); |
| 659 | cc->nh++; |
| 660 | checknext(ls, '='); |
| 661 | rkkey = luaK_exp2RK(fs, &key); |
| 662 | expr(ls, &val); |
| 663 | luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val)); |
| 664 | fs->freereg = reg; /* free registers */ |
| 665 | } |
| 666 | |
| 667 | |
| 668 | static void closelistfield (FuncState *fs, struct ConsControl *cc) { |
no test coverage detected