aboutsummaryrefslogtreecommitdiff
path: root/testes/goto.lua (follow)
Commit message (Collapse)AuthorAgeFilesLines
* No need to limit variable declarations to 250Roberto Ierusalimschy2025-06-181-5/+33
| | | | Only local variables, which use registers, need this low limit.
* New way to control preambular declarationRoberto Ierusalimschy2025-05-201-1/+17
| | | | | Validity of the preambular global declaration in controled together with all declarations, when checking variable names.
* Proper error message when jumping into 'global *'Roberto Ierusalimschy2025-05-181-5/+8
| | | | | | A goto cannot jump into the scope of any variable declaration, including 'global *'. To report the error, it needs a "name" for the scope it is entering.
* Variable attributes can prefix name listRoberto Ierusalimschy2025-05-181-6/+6
| | | | | In this format, the attribute applies to all names in the list; e.g. "global<const> print, require, math".
* Collective declaration for globals ('global *')Roberto Ierusalimschy2025-05-131-6/+18
|
* Correct line in error message for constant functionRoberto Ierusalimschy2025-05-121-0/+7
|
* New syntax 'global function'Roberto Ierusalimschy2025-05-081-1/+22
|
* First implementation of global declarationsRoberto Ierusalimschy2025-05-051-1/+43
|
* Removed copyright notice from 'testes/all.lua'Roberto Ierusalimschy2025-03-121-1/+1
| | | | All test files refer to the main copyright notice in 'lua.h'.
* Another way to compile goto'sRoberto Ierusalimschy2025-01-101-10/+25
| | | | | | | | | | | | The compilation of a goto or a label just create an entry and generate boilerplate code for the gotos. As we don't know yet whether it needs a CLOSE, we code a jump followed by a CLOSE, which is then dead code. When a block ends (and then we know for sure whether there are variables that need to be closed), we check the goto's against the labels of that block. When closing a goto against a label, if it needs a CLOSE, the compiler swaps the order of the jump and the CLOSE, making the CLOSE active.
* Change in the syntax of attributesRoberto Ierusalimschy2019-07-301-1/+1
| | | | | | | Attributes changed to posfixed ('x <const>', instead of '<const> x'), and "toclose" renamed to "close". Posfixed attributes seem to make it clearer that it applies to only one variable when there are multiple variables.
* Flag for to-be-closed variables changed to '<toclose>'Roberto Ierusalimschy2019-05-091-1/+1
| | | | | | | The flag for to-be-closed variables was changed from '*toclose' to '<toclose>'. Several people found confusing the old syntax and the new one has a clear terminator, making it more flexible for future changes.
* No more to-be-closed functionsRoberto Ierusalimschy2019-01-041-1/+1
| | | | | | | | | | | | | | | | | | | To-be-closed variables must contain objects with '__toclose' metamethods (or nil). Functions were removed for several reasons: * Functions interact badly with sandboxes. If a sandbox raises an error to interrupt a script, a to-be-closed function still can hijack control and continue running arbitrary sandboxed code. * Functions interact badly with coroutines. If a coroutine yields and is never resumed again, its to-be-closed functions will never run. To-be-closed objects, on the other hand, will still be closed, provided they have appropriate finalizers. * If you really need a function, it is easy to create a dummy object to run that function in its '__toclose' metamethod. This comit also adds closing of variables in case of panic.
* New syntax for to-be-closed variablesRoberto Ierusalimschy2018-11-071-1/+1
| | | | | | | The new syntax is <local *toclose x = f()>. The mark '*' allows other attributes to be added later without the need of new keywords; it also allows better error messages. The API function was also renamed ('lua_tobeclosed' -> 'lua_toclose').
* Back with optimization for 'if cond then goto'Roberto Ierusalimschy2018-10-301-0/+16
| | | | | | | | | | | | Statements like 'if cond then goto label' generate code so that the jump in the 'if' goes directly to the given label. This optimization cannot be done when the jump is backwards leaving the scope of some variable, as it cannot add the needed 'close' instruction. (The jumps were already generated by the 'if'.) This commit also added 'likely'/'unlikely' for tests for errors in the parser, and it changed the way breaks outside loops are detected. (Now they are detected like other goto's with undefined labels.)
* Big revamp in the implmentation of labels/gotosRoberto Ierusalimschy2018-10-291-2/+1
| | | | | | | | Added restriction that, when a label is created, there cannot be another label with the same name visible. That allows backward goto's to be resolved when they are read. Backward goto's get a close if they jump out of the scope of some variable; labels get a close only if previous goto to it jumps out of the scope of some upvalue.
* Added directory to test file names in '$Id:'Roberto Ierusalimschy2018-07-251-1/+1
| | | | | | | From the point of view of 'git', all names are relative to the root directory of the project. So, file names in '$Id:' also should be relative to that directory: the proper name for test file 'all.lua' is 'testes/all.lua'.
* Added manual and tests for version 5.4-w2Roberto Ierusalimschy2018-07-091-0/+256