mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-19 00:16:29 +08:00
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()
|
||||
elif builtins.is_bytes(value.type):
|
||||
format_string += "bytes(["; flush()
|
||||
elif builtins.is_bytearray(value.type):
|
||||
format_string += "bytearray(["; flush()
|
||||
elif builtins.is_array(value.type):
|
||||
format_string += "array(["; flush()
|
||||
else:
|
||||
@ -2017,7 +2019,8 @@ class ARTIQIRGenerator(algorithm.Visitor):
|
||||
|
||||
if builtins.is_list(value.type):
|
||||
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 += "])"
|
||||
elif builtins.is_range(value.type):
|
||||
format_string += "range("; flush()
|
||||
|
@ -36,3 +36,6 @@ print(array([1, 2]))
|
||||
|
||||
# CHECK-L: bytes([97, 98])
|
||||
print(b"ab")
|
||||
|
||||
# CHECK-L: bytearray([97, 98])
|
||||
print(bytearray(b"ab"))
|
||||
|
Loading…
Reference in New Issue
Block a user