diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-31 10:43:51 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-31 10:43:51 -0300 |
| commit | f645d3157372c73573dff221c5b26691cb0e7d56 (patch) | |
| tree | 61adb1f332bbd8c0c0365b81cef8de47fa2ea06a /ltests.c | |
| parent | 35b4efc270db2418bc2cac6671575a45028061c3 (diff) | |
| download | lua-f645d3157372c73573dff221c5b26691cb0e7d56.tar.gz lua-f645d3157372c73573dff221c5b26691cb0e7d56.tar.bz2 lua-f645d3157372c73573dff221c5b26691cb0e7d56.zip | |
To-be-closed variables must be closed on initialization
When initializing a to-be-closed variable, check whether it has a
'__close' metamethod (or is a false value) and raise an error if
if it hasn't. This produces more accurate error messages. (The
check before closing still need to be done: in the C API, the value
is not constant; and the object may lose its '__close' metamethod
during the block.)
Diffstat (limited to 'ltests.c')
| -rw-r--r-- | ltests.c | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -1572,6 +1572,9 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
| 1572 | else if EQ("error") { | 1572 | else if EQ("error") { |
| 1573 | lua_error(L1); | 1573 | lua_error(L1); |
| 1574 | } | 1574 | } |
| 1575 | else if EQ("abort") { | ||
| 1576 | abort(); | ||
| 1577 | } | ||
| 1575 | else if EQ("throw") { | 1578 | else if EQ("throw") { |
| 1576 | #if defined(__cplusplus) | 1579 | #if defined(__cplusplus) |
| 1577 | static struct X { int x; } x; | 1580 | static struct X { int x; } x; |
