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

Function funcargs

third-party/lua-5.3.5/src/lparser.c:817–859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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