| 826 | |
| 827 | |
| 828 | static void recfield (LexState *ls, ConsControl *cc) { |
| 829 | /* recfield -> (NAME | '['exp']') = exp */ |
| 830 | FuncState *fs = ls->fs; |
| 831 | int reg = ls->fs->freereg; |
| 832 | expdesc tab, key, val; |
| 833 | if (ls->t.token == TK_NAME) { |
| 834 | checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); |
| 835 | codename(ls, &key); |
| 836 | } |
| 837 | else /* ls->t.token == '[' */ |
| 838 | yindex(ls, &key); |
| 839 | cc->nh++; |
| 840 | checknext(ls, '='); |
| 841 | tab = *cc->t; |
| 842 | luaK_indexed(fs, &tab, &key); |
| 843 | expr(ls, &val); |
| 844 | luaK_storevar(fs, &tab, &val); |
| 845 | fs->freereg = reg; /* free registers */ |
| 846 | } |
| 847 | |
| 848 | |
| 849 | static void closelistfield (FuncState *fs, ConsControl *cc) { |
no test coverage detected