@@ -309,34 +309,37 @@ def _(d, mapper, rebuilt, sregistry):
309309 rebuilt [idim0 ] = idim1 = idim0 ._rebuild (name = iname )
310310
311311 kwargs ['implicit_dimension' ] = idim1
312- fkwargs ['dimensions' ] = (idim1 ,) + d . functions . dimensions [1 :]
312+ fkwargs ['dimensions' ] = (idim1 ,) + as_tuple ( f . dimensions [1 :] for f in d . functions )
313313
314- if d .functions in rebuilt :
315- functions = rebuilt [d .functions ]
316- else :
317- # Increment every instance of this name after the first encountered
318- fname = sregistry .make_name (prefix = d .functions .name , increment_first = False )
319- # Warn the user if name has been changed, since this will affect overrides
320- if fname != d .functions .name :
321- fkwargs ['name' ] = fname
322- warning (
323- f"{ str (d .functions )} <{ id (d .functions )} > renamed as '{ fname } '. "
324- "Consider assigning a unique name to {d.functions.name}."
325- )
326-
327- fkwargs .update ({'function' : None ,
328- 'halo' : None ,
329- 'padding' : None })
330-
331- # Data in MultiSubDimension function may not have been touched at this point,
332- # in which case do not use an allocator, as there is nothing to allocate, and
333- # doing so will petrify the `_data` attribute as None.
334- if d .functions ._data is not None :
335- fkwargs .update ({'allocator' : DataReference (d .functions ._data )})
336-
337- rebuilt [d .functions ] = functions = d .functions ._rebuild (** fkwargs )
338-
339- kwargs ['functions' ] = functions
314+ functions = []
315+ for f in as_tuple (d .functions ):
316+ if f in rebuilt :
317+ functions .append (rebuilt [f ])
318+ else :
319+ # Increment every instance of this name after the first encountered
320+ fname = sregistry .make_name (prefix = f .name , increment_first = False )
321+ # Warn the user if name has been changed, since this will affect overrides
322+ if fname != f .name :
323+ fkwargs ['name' ] = fname
324+ warning (
325+ f"{ str (f )} <{ id (f )} > renamed as '{ fname } '. "
326+ f"Consider assigning a unique name to { f .name } ."
327+ )
328+
329+ fkwargs .update ({'function' : None ,
330+ 'halo' : None ,
331+ 'padding' : None })
332+
333+ # Data in MultiSubDimension function may not have been touched at this point,
334+ # in which case do not use an allocator, as there is nothing to allocate, and
335+ # doing so will petrify the `_data` attribute as None.
336+ if f ._data is not None :
337+ fkwargs .update ({'allocator' : DataReference (f ._data )})
338+
339+ rebuilt [f ] = f ._rebuild (** fkwargs )
340+ functions .append (rebuilt [f ])
341+
342+ kwargs ['functions' ] = tuple (functions )
340343
341344 mapper [d ] = d ._rebuild (** kwargs )
342345 mapper .update (zip (d .thickness , tkns , strict = True ))
0 commit comments