forked from M-Labs/artiq
compiler: add support for printing of bytearray values (#714).
This commit is contained in:
parent
e9564b15c8
commit
9ed4e9c1cd
|
@ -1989,6 +1989,8 @@ class ARTIQIRGenerator(algorithm.Visitor):
|
||||||
format_string += "["; flush()
|
format_string += "["; flush()
|
||||||
elif builtins.is_bytes(value.type):
|
elif builtins.is_bytes(value.type):
|
||||||
format_string += "bytes(["; flush()
|
format_string += "bytes(["; flush()
|
||||||
|
elif builtins.is_bytearray(value.type):
|
||||||
|
format_string += "bytearray(["; flush()
|
||||||
elif builtins.is_array(value.type):
|
elif builtins.is_array(value.type):
|
||||||
format_string += "array(["; flush()
|
format_string += "array(["; flush()
|
||||||
else:
|
else:
|
||||||
|
@ -2017,7 +2019,8 @@ class ARTIQIRGenerator(algorithm.Visitor):
|
||||||
|
|
||||||
if builtins.is_list(value.type):
|
if builtins.is_list(value.type):
|
||||||
format_string += "]"
|
format_string += "]"
|
||||||
elif builtins.is_array(value.type) or builtins.is_bytes(value.type):
|
elif (builtins.is_bytes(value.type) or builtins.is_bytearray(value.type) or
|
||||||
|
builtins.is_array(value.type)):
|
||||||
format_string += "])"
|
format_string += "])"
|
||||||
elif builtins.is_range(value.type):
|
elif builtins.is_range(value.type):
|
||||||
format_string += "range("; flush()
|
format_string += "range("; flush()
|
||||||
|
|
|
@ -36,3 +36,6 @@ print(array([1, 2]))
|
||||||
|
|
||||||
# CHECK-L: bytes([97, 98])
|
# CHECK-L: bytes([97, 98])
|
||||||
print(b"ab")
|
print(b"ab")
|
||||||
|
|
||||||
|
# CHECK-L: bytearray([97, 98])
|
||||||
|
print(bytearray(b"ab"))
|
||||||
|
|
Loading…
Reference in New Issue