Internalized string "break" kept by the parser
The parser uses "break" as fake label to compile "break" as "goto break". To avoid producing this string at each use, it keeps it available in its state.
This commit is contained in:
3
llex.c
3
llex.c
@@ -190,6 +190,9 @@ void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source,
|
||||
ls->lastline = 1;
|
||||
ls->source = source;
|
||||
ls->envn = luaS_newliteral(L, LUA_ENV); /* get env name */
|
||||
ls->brkn = luaS_newliteral(L, "break"); /* get "break" name */
|
||||
/* "break" cannot be collected, as it is a reserved word" */
|
||||
lua_assert(isreserved(ls->brkn));
|
||||
luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user