MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / funcargs

Function funcargs

ThirdParty/lua/lua/lparser.c:811–853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

809
810
811static void funcargs (LexState *ls, expdesc *f, int line) {
812 FuncState *fs = ls->fs;
813 expdesc args;
814 int base, nparams;
815 switch (ls->t.token) {
816 case '(': { /* funcargs -> '(' [ explist ] ')' */
817 luaX_next(ls);
818 if (ls->t.token == ')') /* arg list is empty? */
819 args.k = VVOID;
820 else {
821 explist(ls, &args);
822 luaK_setmultret(fs, &args);
823 }
824 check_match(ls, ')', '(', line);
825 break;
826 }
827 case '{': { /* funcargs -> constructor */
828 constructor(ls, &args);
829 break;
830 }
831 case TK_STRING: { /* funcargs -> STRING */
832 codestring(ls, &args, ls->t.seminfo.ts);
833 luaX_next(ls); /* must use 'seminfo' before 'next' */
834 break;
835 }
836 default: {
837 luaX_syntaxerror(ls, "function arguments expected");
838 }
839 }
840 lua_assert(f->k == VNONRELOC);
841 base = f->u.info; /* base register for call */
842 if (hasmultret(args.k))
843 nparams = LUA_MULTRET; /* open call */
844 else {
845 if (args.k != VVOID)
846 luaK_exp2nextreg(fs, &args); /* close last argument */
847 nparams = fs->freereg - (base+1);
848 }
849 init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2));
850 luaK_fixline(fs, line);
851 fs->freereg = base+1; /* call remove function and arguments and leaves
852 (unless changed) one result */
853}
854
855
856

Callers 1

suffixedexpFunction · 0.85

Calls 10

luaX_nextFunction · 0.85
explistFunction · 0.85
constructorFunction · 0.85
codestringFunction · 0.85
luaX_syntaxerrorFunction · 0.85
luaK_exp2nextregFunction · 0.85
init_expFunction · 0.85
luaK_codeABCFunction · 0.85
luaK_fixlineFunction · 0.85
check_matchFunction · 0.70

Tested by

no test coverage detected