static void body (LexState *ls, expdesc *e, int needself, int line) { /* body -> `(' parlist `)' chunk END */ FuncState new_fs; open_func(ls, &new_fs); try { new_fs.f->linedefined = line; checknext(ls, '('); if (needself) { new_localvarliteral(ls, "self", 0); adjustlocalvars(ls, 1); } parlist(ls); checknext(ls, ')'); chunk(ls); new_fs.f->lastlinedefined = ls->linenumber; check_match(ls, TK_END, TK_FUNCTION, line); } catch( ... ) { close_func(ls); // We do not need the proto anymore. new_fs.f->DereferenceGC( ls->L ); throw; } close_func(ls); pushclosure(ls, &new_fs, e); // Terminate the FuncState again. new_fs.f->DereferenceGC( ls->L ); }
static void body (LexState *ls, expdesc *e, int needself, int line) { /* body -> `(' parlist `)' chunk END */ FuncState new_fs; open_func(ls, &new_fs); new_fs.f->lineDefined = line; check(ls, '('); if (needself) create_local(ls, "self"); parlist(ls); check(ls, ')'); chunk(ls); check_match(ls, TK_END, TK_FUNCTION, line); close_func(ls); pushclosure(ls, &new_fs, e); }
static void body (LexState *ls, expdesc *e, int needself, int line) { /* body -> `(' parlist `)' chunk END */ #ifdef LUA_UTILITIES_NET char szFuncName1[256]; char szFuncName2[256]; #endif FuncState new_fs; open_func(ls, &new_fs); new_fs.f->linedefined = line; #ifdef LUA_UTILITIES_NET szFuncName1[0] = 0; szFuncName2[0] = 0; TryGetFunctionName(ls->t.seminfo.ts, szFuncName1, 256); #endif checknext(ls, '('); if (needself) { new_localvarliteral(ls, "self", 0); adjustlocalvars(ls, 1); } parlist(ls); checknext(ls, ')'); chunk(ls); #ifdef LUA_UTILITIES_NET if (szFuncName1[0] == 0) TryGetFunctionName(ls->t.seminfo.ts, szFuncName2, 256); #endif new_fs.f->lastlinedefined = ls->linenumber; check_match(ls, TK_END, TK_FUNCTION, line); close_func(ls); #ifdef LUA_UTILITIES_NET // Use the correct function name based on values obtained if (szFuncName1[0] == 0) GetFunction(szFuncName2, ls, new_fs.f); else GetFunction(szFuncName1, ls, new_fs.f); #endif pushclosure(ls, &new_fs, e); }
static void body (LexState *ls, expdesc *e, int needself, int line) { /* body -> `(' parlist `)' chunk END */ FuncState new_fs; open_func(ls, &new_fs); new_fs.f->linedefined = line; checknext(ls, '('); if (needself) { new_localvarliteral(ls, "self", 0); adjustlocalvars(ls, 1); } parlist(ls); checknext(ls, ')'); chunk(ls); new_fs.f->lastlinedefined = ls->linenumber; check_match(ls, TK_END, TK_FUNCTION, line); close_func(ls); pushclosure(ls, &new_fs, e); }