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. --- lparser.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lparser.h') diff --git a/lparser.h b/lparser.h index e158c9d9..1b94a97a 100644 --- a/lparser.h +++ b/lparser.h @@ -133,6 +133,7 @@ typedef struct FuncState { lu_byte nups; /* number of upvalues */ lu_byte freereg; /* first free register */ lu_byte iwthabs; /* instructions issued since last absolute line info */ + lu_byte needclose; /* function needs to close upvalues when returning */ } FuncState; -- cgit v1.2.3-55-g6feb