diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-10-17 10:44:42 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-10-17 10:44:42 -0300 |
| commit | bd96330d037660d9a1769c6c0d989f017e5f0278 (patch) | |
| tree | c3f4580c628a71f512b057b7f52987153cb88d74 /testes/api.lua | |
| parent | 4cd1f4aac01184765818e0cebf02da454ccf6590 (diff) | |
| download | lua-bd96330d037660d9a1769c6c0d989f017e5f0278.tar.gz lua-bd96330d037660d9a1769c6c0d989f017e5f0278.tar.bz2 lua-bd96330d037660d9a1769c6c0d989f017e5f0278.zip | |
First "complete" implementation of to-be-closed variables
Still missing:
- handling of memory errors when creating upvalue (must run closing
method all the same)
- interaction with coroutines
Diffstat (limited to 'testes/api.lua')
| -rw-r--r-- | testes/api.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/testes/api.lua b/testes/api.lua index bebb6d2d..925a80c1 100644 --- a/testes/api.lua +++ b/testes/api.lua | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | -- $Id: testes/api.lua $ | 1 | -- $Id: testes/api.lua 2018-07-25 15:31:04 -0300 $ |
| 2 | -- See Copyright Notice in file all.lua | 2 | -- See Copyright Notice in file all.lua |
| 3 | 3 | ||
| 4 | if T==nil then | 4 | if T==nil then |
| @@ -1027,6 +1027,18 @@ testamem("coroutine creation", function() | |||
| 1027 | end) | 1027 | end) |
| 1028 | 1028 | ||
| 1029 | 1029 | ||
| 1030 | -- testing to-be-closed variables | ||
| 1031 | testamem("to-be-closed variables", function() | ||
| 1032 | local flag | ||
| 1033 | do | ||
| 1034 | local scoped x = function () flag = true end | ||
| 1035 | flag = false | ||
| 1036 | local x = {} | ||
| 1037 | end | ||
| 1038 | return flag | ||
| 1039 | end) | ||
| 1040 | |||
| 1041 | |||
| 1030 | -- testing threads | 1042 | -- testing threads |
| 1031 | 1043 | ||
| 1032 | -- get main thread from registry (at index LUA_RIDX_MAINTHREAD == 1) | 1044 | -- get main thread from registry (at index LUA_RIDX_MAINTHREAD == 1) |
