MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / parlist

Function parlist

lib/lua/src/lparser.c:959–987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

bodyFunction · 0.85

Calls 8

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

Tested by

no test coverage detected