MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / parlist

Function parlist

src/Chain/libraries/glua/lparser.cpp:781–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779
780
781static void parlist(LexState *ls) {
782 /* parlist -> [ param { ',' param } ] */
783 FuncState *fs = ls->fs;
784 Proto *f = fs->f;
785 int nparams = 0;
786 f->is_vararg = 0;
787 if (ls->t.token != ')') { /* is 'parlist' not empty? */
788 do {
789 switch (ls->t.token) {
790 case TK_NAME: { /* param -> NAME */
791 new_localvar(ls, str_checkname(ls));
792 nparams++;
793 break;
794 }
795 case TK_DOTS: { /* param -> '...' */
796 luaX_next(ls);
797 f->is_vararg = 2; /* declared vararg */
798 break;
799 }
800 default: luaX_syntaxerror(ls, "<name> or '...' expected");
801 }
802 } while (!f->is_vararg && testnext(ls, ','));
803 }
804 adjustlocalvars(ls, nparams);
805 f->numparams = cast_byte(fs->nactvar);
806 luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */
807}
808
809
810static 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