mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
On second thought, disable explicitcast for list+nonlist and nonlist+list entirely, as they are not the same as list+(list)nonlist and (list)nonlist+list anyway.
This commit is contained in:
parent
d8649deebd
commit
0122d6ed70
1 changed files with 4 additions and 9 deletions
|
@ -1125,18 +1125,13 @@ list lazy_list_set(list L, integer i, list v)
|
|||
if ltype == rtype == 'key':
|
||||
# key + key is the only disallowed combo of equals
|
||||
raise EParseTypeMismatch(self)
|
||||
if self.explicitcast:
|
||||
if ltype == 'list' != rtype:
|
||||
rexpr = {'nt':'CAST', 't':ltype, 'ch':[rexpr]}
|
||||
elif rtype == 'list' != ltype:
|
||||
term = {'nt':'CAST', 't':rtype, 'ch':[term]}
|
||||
# Note that although list + nonlist is semantically the
|
||||
# same as list + (list)nonlist, and similarly for
|
||||
# nonlist + list, they don't compile to the same thing,
|
||||
# so we don't act on self.explicitcast in this case.
|
||||
if rtype == 'list':
|
||||
ltype = rtype
|
||||
term = {'nt':op, 't':ltype, 'ch':[term, rexpr]}
|
||||
# Note that although list + nonlist is semantically the same as
|
||||
# list + (list)nonlist and same goes for nonlist + list, they
|
||||
# don't compile to the same thing, but the optimizer should deal
|
||||
# with typecast removal anyway.
|
||||
elif self.allowkeyconcat and op == '+' \
|
||||
and ltype in ('key', 'string') and rtype in ('key', 'string'):
|
||||
# Allow string+key addition (but add explicit cast)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue