MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / funcargs

Function funcargs

third-party/lua-5.2.4/src/lparser.c:823–865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

suffixedexpFunction · 0.70

Calls 10

luaX_nextFunction · 0.70
explistFunction · 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