MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / parlist

Function parlist

third-party/lua-5.5.0/src/lparser.c:1065–1100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1063
1064
1065static void parlist (LexState *ls) {
1066 /* parlist -> [ {NAME ','} (NAME | '...') ] */
1067 FuncState *fs = ls->fs;
1068 Proto *f = fs->f;
1069 int nparams = 0;
1070 int varargk = 0;
1071 if (ls->t.token != ')') { /* is 'parlist' not empty? */
1072 do {
1073 switch (ls->t.token) {
1074 case TK_NAME: {
1075 new_localvar(ls, str_checkname(ls));
1076 nparams++;
1077 break;
1078 }
1079 case TK_DOTS: {
1080 varargk = 1;
1081 luaX_next(ls); /* skip '...' */
1082 if (ls->t.token == TK_NAME)
1083 new_varkind(ls, str_checkname(ls), RDKVAVAR);
1084 else
1085 new_localvarliteral(ls, "(vararg table)");
1086 break;
1087 }
1088 default: luaX_syntaxerror(ls, "<name> or '...' expected");
1089 }
1090 } while (!varargk && testnext(ls, ','));
1091 }
1092 adjustlocalvars(ls, nparams);
1093 f->numparams = cast_byte(fs->nactvar);
1094 if (varargk) {
1095 setvararg(fs); /* declared vararg */
1096 adjustlocalvars(ls, 1); /* vararg parameter */
1097 }
1098 /* reserve registers for parameters (plus vararg parameter, if present) */
1099 luaK_reserveregs(fs, fs->nactvar);
1100}
1101
1102
1103static void body (LexState *ls, expdesc *e, int ismethod, int line) {

Callers 1

bodyFunction · 0.70

Calls 9

new_varkindFunction · 0.85
new_localvarFunction · 0.70
str_checknameFunction · 0.70
luaX_nextFunction · 0.70
luaX_syntaxerrorFunction · 0.70
testnextFunction · 0.70
adjustlocalvarsFunction · 0.70
setvarargFunction · 0.70
luaK_reserveregsFunction · 0.70

Tested by

no test coverage detected