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

Function parlist

third-party/lua-5.4.6/src/lparser.c:958–986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

956
957
958static void parlist (LexState *ls) {
959 /* parlist -> [ {NAME ','} (NAME | '...') ] */
960 FuncState *fs = ls->fs;
961 Proto *f = fs->f;
962 int nparams = 0;
963 int isvararg = 0;
964 if (ls->t.token != ')') { /* is 'parlist' not empty? */
965 do {
966 switch (ls->t.token) {
967 case TK_NAME: {
968 new_localvar(ls, str_checkname(ls));
969 nparams++;
970 break;
971 }
972 case TK_DOTS: {
973 luaX_next(ls);
974 isvararg = 1;
975 break;
976 }
977 default: luaX_syntaxerror(ls, "<name> or '...' expected");
978 }
979 } while (!isvararg && testnext(ls, ','));
980 }
981 adjustlocalvars(ls, nparams);
982 f->numparams = cast_byte(fs->nactvar);
983 if (isvararg)
984 setvararg(fs, f->numparams); /* declared vararg */
985 luaK_reserveregs(fs, fs->nactvar); /* reserve registers for parameters */
986}
987
988
989static void body (LexState *ls, expdesc *e, int ismethod, int line) {

Callers 1

bodyFunction · 0.70

Calls 8

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