summaryrefslogtreecommitdiff
path: root/lgc.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 /lgc.c
parentb114c7d4871051cbdd7af185a61f35fe4028da79 (diff)
downloadlua-github-4cd1f4aac01184765818e0cebf02da454ccf6590.tar.gz
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 'lgc.c')
-rw-r--r--lgc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lgc.c b/lgc.c
index e8429e1b..39b3ab73 100644
--- a/lgc.c
+++ b/lgc.c
@@ -293,7 +293,8 @@ static void reallymarkobject (global_State *g, GCObject *o) {
gray2black(o);
break;
}
- case LUA_TUPVAL: {
+ case LUA_TUPVAL:
+ case LUA_TUPVALTBC: {
UpVal *uv = gco2upv(o);
if (!upisopen(uv)) /* open upvalues are kept gray */
gray2black(o);
@@ -760,6 +761,7 @@ static void freeobj (lua_State *L, GCObject *o) {
luaF_freeproto(L, gco2p(o));
break;
case LUA_TUPVAL:
+ case LUA_TUPVALTBC:
freeupval(L, gco2upv(o));
break;
case LUA_TLCL: