aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-10-08 10:42:07 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-10-08 10:42:07 -0300
commit4cd1f4aac01184765818e0cebf02da454ccf6590 (patch)
treec7e6398095afccc9987ed42598477094b6ee2aa6 /ldo.c
parentb114c7d4871051cbdd7af185a61f35fe4028da79 (diff)
downloadlua-4cd1f4aac01184765818e0cebf02da454ccf6590.tar.gz
lua-4cd1f4aac01184765818e0cebf02da454ccf6590.tar.bz2
lua-4cd1f4aac01184765818e0cebf02da454ccf6590.zip
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.
Diffstat (limited to '')
-rw-r--r--ldo.c3
1 files changed, 1 insertions, 2 deletions
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 {
91static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { 91static void seterrorobj (lua_State *L, int errcode, StkId oldtop) {
92 switch (errcode) { 92 switch (errcode) {
93 case LUA_ERRMEM: { /* memory error? */ 93 case LUA_ERRMEM: { /* memory error? */
94 TString *memerrmsg = luaS_newliteral(L, MEMERRMSG); 94 setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */
95 setsvalue2s(L, oldtop, memerrmsg); /* reuse preregistered msg. */
96 break; 95 break;
97 } 96 }
98 case LUA_ERRERR: { 97 case LUA_ERRERR: {