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

Function initglobal

third-party/lua-5.5.0/src/lparser.c:1894–1912  ·  view source on GitHub ↗

** Recursively traverse list of globals to be initalized. When ** going, generate table description for the global. In the end, ** after all indices have been generated, read list of initializing ** expressions. When returning, generate the assignment of the value on ** the stack to the corresponding table description. 'n' is the variable ** being handled, range [0, nvars - 1]. */

Source from the content-addressed store, hash-verified

1892** being handled, range [0, nvars - 1].
1893*/
1894static void initglobal (LexState *ls, int nvars, int firstidx, int n,
1895 int line) {
1896 if (n == nvars) { /* traversed all variables? */
1897 expdesc e;
1898 int nexps = explist(ls, &e); /* read list of expressions */
1899 adjust_assign(ls, nvars, nexps, &e);
1900 }
1901 else { /* handle variable 'n' */
1902 FuncState *fs = ls->fs;
1903 expdesc var;
1904 TString *varname = getlocalvardesc(fs, firstidx + n)->vd.name;
1905 buildglobal(ls, varname, &var); /* create global variable in 'var' */
1906 enterlevel(ls); /* control recursion depth */
1907 initglobal(ls, nvars, firstidx, n + 1, line);
1908 leavelevel(ls);
1909 checkglobal(ls, varname, line);
1910 storevartop(fs, &var);
1911 }
1912}
1913
1914
1915static void globalnames (LexState *ls, lu_byte defkind) {

Callers 1

globalnamesFunction · 0.85

Calls 7

buildglobalFunction · 0.85
checkglobalFunction · 0.85
storevartopFunction · 0.85
explistFunction · 0.70
adjust_assignFunction · 0.70
getlocalvardescFunction · 0.70
enterlevelFunction · 0.50

Tested by

no test coverage detected