return _InternalRepl(self, count, src_loc_at=src_loc_at)
def __Cat__(self, *args, src_loc_at=0):
- args = [self] + list(args)
- return _InternalCat(*args, src_loc_at=src_loc_at)
+ return _InternalCat(self, *args, src_loc_at=src_loc_at)
def __Mux__(self, val1, val0):
return _InternalMux(self, val1, val0)
if len(args) == 0:
return _InternalCat(*args, src_loc_at=src_loc_at)
# determine if the first is a UserValue.
- if isinstance(args[0], UserValue):
- first = args[0] # take UserValue directly, do not downcast
- else:
- first = Value.cast(args[0]) # ok to downcast to Value
+ first, rest = args[0], args[1:]
+ if not isinstance(args[0], UserValue):
+ first = Value.cast(first) # ok to downcast to Value
# all other arguments are safe to downcast to Value
- rest = [Value.cast(v) for v in flatten(args[1:])]
+ rest = map(Value.cast, rest)
# assume first item defines the "handling" for all others
return first.__Cat__(*rest, src_loc_at=src_loc_at)