MCPcopy Create free account
hub / github.com/F-Stack/f-stack / funcargs

Function funcargs

freebsd/contrib/openzfs/module/lua/lparser.c:827–869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

825
826
827static void funcargs (LexState *ls, expdesc *f, int line) {
828 FuncState *fs = ls->fs;
829 expdesc args;
830 int base, nparams;
831 switch (ls->t.token) {
832 case '(': { /* funcargs -> `(' [ explist ] `)' */
833 luaX_next(ls);
834 if (ls->t.token == ')') /* arg list is empty? */
835 args.k = VVOID;
836 else {
837 explist(ls, &args);
838 luaK_setmultret(fs, &args);
839 }
840 check_match(ls, ')', '(', line);
841 break;
842 }
843 case '{': { /* funcargs -> constructor */
844 constructor(ls, &args);
845 break;
846 }
847 case TK_STRING: { /* funcargs -> STRING */
848 codestring(ls, &args, ls->t.seminfo.ts);
849 luaX_next(ls); /* must use `seminfo' before `next' */
850 break;
851 }
852 default: {
853 luaX_syntaxerror(ls, "function arguments expected");
854 }
855 }
856 lua_assert(f->k == VNONRELOC);
857 base = f->u.info; /* base register for call */
858 if (hasmultret(args.k))
859 nparams = LUA_MULTRET; /* open call */
860 else {
861 if (args.k != VVOID)
862 luaK_exp2nextreg(fs, &args); /* close last argument */
863 nparams = fs->freereg - (base+1);
864 }
865 init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2));
866 luaK_fixline(fs, line);
867 fs->freereg = base+1; /* call remove function and arguments and leaves
868 (unless changed) one result */
869}
870
871
872

Callers 1

suffixedexpFunction · 0.70

Calls 10

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

Tested by

no test coverage detected