MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / parlist

Function parlist

lua/lparser.c:573–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571
572
573static void parlist (LexState *ls) {
574 /* parlist -> [ param { `,' param } ] */
575 FuncState *fs = ls->fs;
576 Proto *f = fs->f;
577 int nparams = 0;
578 f->is_vararg = 0;
579 if (ls->t.token != ')') { /* is `parlist' not empty? */
580 do {
581 switch (ls->t.token) {
582 case TK_NAME: { /* param -> NAME */
583 new_localvar(ls, str_checkname(ls), nparams);
584 const char *typestr = txtToken(ls, ls->t.token);
585 if ((f->argtypes[nparams] = luabb_dbtype_by_name(typestr)) != 0)
586 luaX_next(ls); /* found arg type */
587 ++nparams;
588 break;
589 }
590 case TK_DOTS: { /* param -> `...' */
591 luaX_next(ls);
592#if defined(LUA_COMPAT_VARARG)
593 /* use `arg' as default name */
594 new_localvarliteral(ls, "arg", nparams++);
595 f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG;
596#endif
597 f->is_vararg |= VARARG_ISVARARG;
598 break;
599 }
600 default: luaX_syntaxerror(ls, "<name> or " LUA_QL("...") " expected");
601 }
602 } while (!f->is_vararg && testnext(ls, ','));
603 }
604 adjustlocalvars(ls, nparams);
605 f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG));
606 luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */
607}
608
609
610static void body (LexState *ls, expdesc *e, int needself, int line) {

Callers 1

bodyFunction · 0.85

Calls 9

new_localvarFunction · 0.85
str_checknameFunction · 0.85
txtTokenFunction · 0.85
luabb_dbtype_by_nameFunction · 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