** 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]. */
| 1892 | ** being handled, range [0, nvars - 1]. |
| 1893 | */ |
| 1894 | static 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 | |
| 1915 | static void globalnames (LexState *ls, lu_byte defkind) { |
no test coverage detected