| 1945 | |
| 1946 | |
| 1947 | static void globalfunc (LexState *ls, int line) { |
| 1948 | /* globalfunc -> (GLOBAL FUNCTION) NAME body */ |
| 1949 | expdesc var, b; |
| 1950 | FuncState *fs = ls->fs; |
| 1951 | TString *fname = str_checkname(ls); |
| 1952 | new_varkind(ls, fname, GDKREG); /* declare global variable */ |
| 1953 | fs->nactvar++; /* enter its scope */ |
| 1954 | buildglobal(ls, fname, &var); |
| 1955 | body(ls, &b, 0, ls->linenumber); /* compile and return closure in 'b' */ |
| 1956 | checkglobal(ls, fname, line); |
| 1957 | luaK_storevar(fs, &var, &b); |
| 1958 | luaK_fixline(fs, line); /* definition "happens" in the first line */ |
| 1959 | } |
| 1960 | |
| 1961 | |
| 1962 | static void globalstatfunc (LexState *ls, int line) { |
no test coverage detected