Lichen

Changeset

650:d1bf04436c7c
2017-03-03 Paul Boddie raw files shortlog changelog graph Produce valid empty allocation locations when allocating attributes/parameters.
optimiser.py (file)
     1.1 --- a/optimiser.py	Fri Mar 03 13:25:11 2017 +0100
     1.2 +++ b/optimiser.py	Fri Mar 03 13:41:13 2017 +0100
     1.3 @@ -1105,7 +1105,7 @@
     1.4              # Handle empty positions.
     1.5  
     1.6              if not attrnames:
     1.7 -                allocated.append([])
     1.8 +                allocated.append([None] * len(names))
     1.9                  continue
    1.10  
    1.11              base = None
    1.12 @@ -1135,7 +1135,12 @@
    1.13                      raise OptimiseError, "Attribute %s cannot be explicitly positioned at %d." % \
    1.14                                           (attrname, len(allocated))
    1.15  
    1.16 -            allocated.append(base)
    1.17 +            # Handle empty positions.
    1.18 +
    1.19 +            if base:
    1.20 +                allocated.append(base)
    1.21 +            else:
    1.22 +                allocated.append([None] * len(names))
    1.23  
    1.24      # Try to allocate each attribute name in turn.
    1.25