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

Function funcargs

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

Source from the content-addressed store, hash-verified

845
846
847static void funcargs(LexState *ls, expdesc *f, int line) {
848 FuncState *fs = ls->fs;
849 expdesc args;
850 int base, nparams;
851 switch (ls->t.token) {
852 case '(': { /* funcargs -> '(' [ explist ] ')' */
853 luaX_next(ls);
854 if (ls->t.token == ')') /* arg list is empty? */
855 args.k = VVOID;
856 else {
857 explist(ls, &args);
858 luaK_setmultret(fs, &args);
859 }
860 check_match(ls, ')', '(', line);
861 break;
862 }
863 case '{': { /* funcargs -> constructor */
864 constructor(ls, &args);
865 break;
866 }
867 case TK_STRING: { /* funcargs -> STRING */
868 codestring(ls, &args, ls->t.seminfo.ts);
869 luaX_next(ls); /* must use 'seminfo' before 'next' */
870 break;
871 }
872 default: {
873 luaX_syntaxerror(ls, "function arguments expected");
874 }
875 }
876 lua_assert(f->k == VNONRELOC);
877 base = f->u.info; /* base register for call */
878 if (hasmultret(args.k))
879 nparams = LUA_MULTRET; /* open call */
880 else {
881 if (args.k != VVOID)
882 luaK_exp2nextreg(fs, &args); /* close last argument */
883 nparams = fs->freereg - (base + 1);
884 }
885 init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams + 1, 2));
886 luaK_fixline(fs, line);
887 fs->freereg = base + 1; /* call remove function and arguments and leaves
888 (unless changed) one result */
889}
890
891
892

Callers 1

suffixedexpFunction · 0.85

Calls 10

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

Tested by

no test coverage detected