From 4cd1f4aac01184765818e0cebf02da454ccf6590 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 8 Oct 2018 10:42:07 -0300 Subject: Towards "to closed" local variables Start of the implementation of "scoped variables" or "to be closed" variables, local variables whose '__close' (or themselves) are called when they go out of scope. This commit implements the syntax, the opcode, and the creation of the corresponding upvalue, but it still does not call the finalizations when the variable goes out of scope (the most important part). Currently, the syntax is 'local scoped name = exp', but that will probably change. --- ldo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ldo.c') diff --git a/ldo.c b/ldo.c index 0d68d36c..2349aaed 100644 --- a/ldo.c +++ b/ldo.c @@ -91,8 +91,7 @@ struct lua_longjmp { static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { switch (errcode) { case LUA_ERRMEM: { /* memory error? */ - TString *memerrmsg = luaS_newliteral(L, MEMERRMSG); - setsvalue2s(L, oldtop, memerrmsg); /* reuse preregistered msg. */ + setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ break; } case LUA_ERRERR: { -- cgit v1.2.3-55-g6feb