From c7e8c043496c239149aa77397273a92afe942cdb Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Wed, 4 Jan 2017 05:10:12 +0100 Subject: [PATCH] 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. --- lslopt/lslparse.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lslopt/lslparse.py b/lslopt/lslparse.py index 7719eef..afc1e3a 100644 --- a/lslopt/lslparse.py +++ b/lslopt/lslparse.py @@ -2064,7 +2064,13 @@ list lazy_list_set(list L, integer i, list v) sym = self.FindSymbolPartial(tok[1]) if sym is None or sym['Kind'] != 'v': 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] == '<': value = [self.Parse_simple_expr()] self.autocastcheck(value[0], 'float')