Parser fix: Give error in state switch when ident is not a state
This commit is contained in:
@@ -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;}}
|
||||
Reference in New Issue
Block a user