MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / parlist

Function parlist

extlibs/lua/src/lparser.c:940–968  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

938
939
940static void parlist (LexState *ls) {
941 /* parlist -> [ param { ',' param } ] */
942 FuncState *fs = ls->fs;
943 Proto *f = fs->f;
944 int nparams = 0;
945 int isvararg = 0;
946 if (ls->t.token != ')') { /* is 'parlist' not empty? */
947 do {
948 switch (ls->t.token) {
949 case TK_NAME: { /* param -> NAME */
950 new_localvar(ls, str_checkname(ls));
951 nparams++;
952 break;
953 }
954 case TK_DOTS: { /* param -> '...' */
955 luaX_next(ls);
956 isvararg = 1;
957 break;
958 }
959 default: luaX_syntaxerror(ls, "<name> or '...' expected");
960 }
961 } while (!isvararg && testnext(ls, ','));
962 }
963 adjustlocalvars(ls, nparams);
964 f->numparams = cast_byte(fs->nactvar);
965 if (isvararg)
966 setvararg(fs, f->numparams); /* declared vararg */
967 luaK_reserveregs(fs, fs->nactvar); /* reserve registers for parameters */
968}
969
970
971static 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