forked from M-Labs/artiq
compiler: add support for printing of bytes values (#714).
This commit is contained in:
parent
dba4e1a28b
commit
7b2da5294f
@ -1986,6 +1986,8 @@ class ARTIQIRGenerator(algorithm.Visitor):
|
||||
elif builtins.is_listish(value.type):
|
||||
if builtins.is_list(value.type):
|
||||
format_string += "["; flush()
|
||||
elif builtins.is_bytes(value.type):
|
||||
format_string += "bytes(["; flush()
|
||||
elif builtins.is_array(value.type):
|
||||
format_string += "array(["; flush()
|
||||
else:
|
||||
@ -2014,7 +2016,7 @@ class ARTIQIRGenerator(algorithm.Visitor):
|
||||
|
||||
if builtins.is_list(value.type):
|
||||
format_string += "]"
|
||||
elif builtins.is_array(value.type):
|
||||
elif builtins.is_array(value.type) or builtins.is_bytes(value.type):
|
||||
format_string += "])"
|
||||
elif builtins.is_range(value.type):
|
||||
format_string += "range("; flush()
|
||||
|
@ -33,3 +33,6 @@ print(range(10))
|
||||
|
||||
# CHECK-L: array([1, 2])
|
||||
print(array([1, 2]))
|
||||
|
||||
# CHECK-L: bytes([97, 98])
|
||||
print(b"ab")
|
||||
|
Loading…
Reference in New Issue
Block a user