Proper error message when jumping into 'global *'

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.
This commit is contained in:
Roberto Ierusalimschy
2025-05-18 12:03:54 -03:00
parent abbae57c78
commit 6d53701c7a
3 changed files with 12 additions and 9 deletions

View File

@@ -1504,7 +1504,7 @@ labels in Lua are considered statements too:
A label is visible in the entire block where it is defined,
except inside nested functions.
A goto can jump to any visible label as long as it does not
enter into the scope of a local variable.
enter into the scope of a variable declaration.
A label should not be declared
where a previous label with the same name is visible,
even if this other label has been declared in an enclosing block.