MCPcopy Create free account
hub / github.com/DFHack/dfhack / parlist

Function parlist

depends/lua/src/lparser.c:754–780  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

752
753
754static void parlist (LexState *ls) {
755 /* parlist -> [ param { ',' param } ] */
756 FuncState *fs = ls->fs;
757 Proto *f = fs->f;
758 int nparams = 0;
759 f->is_vararg = 0;
760 if (ls->t.token != ')') { /* is 'parlist' not empty? */
761 do {
762 switch (ls->t.token) {
763 case TK_NAME: { /* param -> NAME */
764 new_localvar(ls, str_checkname(ls));
765 nparams++;
766 break;
767 }
768 case TK_DOTS: { /* param -> '...' */
769 luaX_next(ls);
770 f->is_vararg = 1; /* declared vararg */
771 break;
772 }
773 default: luaX_syntaxerror(ls, "<name> or '...' expected");
774 }
775 } while (!f->is_vararg && testnext(ls, ','));
776 }
777 adjustlocalvars(ls, nparams);
778 f->numparams = cast_byte(fs->nactvar);
779 luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */
780}
781
782
783static void body (LexState *ls, expdesc *e, int ismethod, int line) {

Callers 1

bodyFunction · 0.85

Calls 7

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

Tested by

no test coverage detected