MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / recfield

Function recfield

3rd/lua-5.4.3/src/lparser.c:835–853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

fieldFunction · 0.85

Calls 7

checklimitFunction · 0.85
codenameFunction · 0.85
yindexFunction · 0.85
checknextFunction · 0.85
luaK_indexedFunction · 0.85
exprFunction · 0.85
luaK_storevarFunction · 0.85

Tested by

no test coverage detected