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. --- lopcodes.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index 9442a336..4d144000 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -251,6 +251,7 @@ OP_LEN,/* A B R(A) := length of R(B) */ OP_CONCAT,/* A B R(A) := R(A).. ... ..R(A + B - 1) */ OP_CLOSE,/* A close all upvalues >= R(A) */ +OP_TBC,/* A mark variable A "to be closed" */ OP_JMP,/* k sJ pc += sJ (k is used in code generation) */ OP_EQ,/* A B if ((R(A) == R(B)) ~= k) then pc++ */ OP_LT,/* A B if ((R(A) < R(B)) ~= k) then pc++ */ -- cgit v1.2.3-55-g6feb