mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Tentatively add support for an LSO quirk with global lists.
When a global list includes a reference to a global variable of type key, the corresponding list entry type is string, not key (SCR-295, possibly caused by SVC-1710 or SVC-4485). This implementation is fishy, because it hard-codes the type in the node regardless of the child types. But in some quick experimenting, it seemed to work. And since the main purpose is to document LSO's behaviour, rather than actually being usable, it's OK like that.
This commit is contained in:
parent
06edf8f152
commit
c7e8c04349
1 changed files with 7 additions and 1 deletions
|
@ -2064,7 +2064,13 @@ list lazy_list_set(list L, integer i, list v)
|
||||||
sym = self.FindSymbolPartial(tok[1])
|
sym = self.FindSymbolPartial(tok[1])
|
||||||
if sym is None or sym['Kind'] != 'v':
|
if sym is None or sym['Kind'] != 'v':
|
||||||
raise EParseUndefined(self)
|
raise EParseUndefined(self)
|
||||||
return {'nt':'IDENT', 't':sym['Type'], 'name':tok[1], 'scope':sym['Scope']}
|
typ = sym['Type']
|
||||||
|
if ForbidList and lslcommon.LSO and typ == 'key':
|
||||||
|
# This attempts to reproduce LSO's behaviour that a key global
|
||||||
|
# var inside a list global definition takes a string value
|
||||||
|
# (SCR-295).
|
||||||
|
typ = 'string'
|
||||||
|
return {'nt':'IDENT', 't':typ, 'name':tok[1], 'scope':sym['Scope']}
|
||||||
if tok[0] == '<':
|
if tok[0] == '<':
|
||||||
value = [self.Parse_simple_expr()]
|
value = [self.Parse_simple_expr()]
|
||||||
self.autocastcheck(value[0], 'float')
|
self.autocastcheck(value[0], 'float')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue