mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2024-11-21 06:15:56 -07:00
Parser fix: Give error in state switch when ident is not a state
This commit is contained in:
parent
1d1aba9687
commit
28de23a03b
3 changed files with 10 additions and 2 deletions
|
@ -1825,8 +1825,11 @@ list lazy_list_set(list L, integer i, list v)
|
|||
raise EParseSyntax(self)
|
||||
# State Switch only searches for states in the global scope
|
||||
name = self.tok[1] if self.tok[0] == 'IDENT' else 'default'
|
||||
if name not in self.symtab[0] and (name not in self.globals
|
||||
or self.globals[name]['Kind'] != 's'):
|
||||
if (name not in self.symtab[0]
|
||||
or self.symtab[0][name]['Kind'] != 's'
|
||||
) and (name not in self.globals
|
||||
or self.globals[name]['Kind'] != 's'
|
||||
):
|
||||
raise EParseUndefined(self)
|
||||
self.NextToken()
|
||||
self.expect(';')
|
||||
|
|
3
unit_tests/regression.suite/state-global.err
Normal file
3
unit_tests/regression.suite/state-global.err
Normal file
|
@ -0,0 +1,3 @@
|
|||
default{timer(){state Z;}}
|
||||
^
|
||||
(Line 2 char 23): ERROR: Name not defined within scope
|
2
unit_tests/regression.suite/state-global.lsl
Normal file
2
unit_tests/regression.suite/state-global.lsl
Normal file
|
@ -0,0 +1,2 @@
|
|||
integer Z;
|
||||
default{timer(){state Z;}}
|
Loading…
Reference in a new issue