+ ls = left.slice
+ if (isinstance(ls, ast.Slice) and isinstance(right, ast.Name) and
+ right.id == 'undefined'):
+ # undefined needs to be copied the exact same slice
+ right = ast.Subscript(right, ls, ast.Load())
+ return ast.Assign([left], right)
+ res = ast.Assign([left], right)
+ if autoassign and isinstance(ls, ast.Slice):
+ # hack to create a variable pre-declared based on a slice.
+ # dividend[0:32] = (RA)[0:32] will create
+ # dividend = [0] * 32
+ # dividend[0:32] = (RA)[0:32]
+ # the declaration makes the slice-assignment "work"
+ lower, upper, step = ls.lower, ls.upper, ls.step
+ print ("lower, upper, step", repr(lower), repr(upper), step)
+ if not isinstance(lower, ast.Constant) or \
+ not isinstance(upper, ast.Constant):
+ return res
+ qty = ast.Num(upper.value-lower.value)
+ keywords = [ast.keyword(arg='repeat', value=qty)]
+ l = [ast.Num(0)]
+ right = ast.Call(ast.Name("concat", ast.Load()), l, keywords)
+ declare = ast.Assign([ast.Name(assignname, ast.Store())], right)
+ return [declare, res]
+ return res