aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
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 /lobject.h
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 'lobject.h')
-rw-r--r--lobject.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lobject.h b/lobject.h
index ddcf609c..ea3511de 100644
--- a/lobject.h
+++ b/lobject.h
@@ -588,6 +588,10 @@ typedef struct UpVal {
588} UpVal; 588} UpVal;
589 589
590 590
591/* variant for "To Be Closed" upvalues */
592#define LUA_TUPVALTBC (LUA_TUPVAL | (1 << 4))
593
594
591#define ClosureHeader \ 595#define ClosureHeader \
592 CommonHeader; lu_byte nupvalues; GCObject *gclist 596 CommonHeader; lu_byte nupvalues; GCObject *gclist
593 597