forked from M-Labs/artiq
1
0
Fork 0

compiler: add support for printing of bytes values (#714).

This commit is contained in:
whitequark 2017-06-09 05:53:20 +00:00
parent dba4e1a28b
commit 7b2da5294f
2 changed files with 6 additions and 1 deletions

View File

@ -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()

View File

@ -33,3 +33,6 @@ print(range(10))
# CHECK-L: array([1, 2])
print(array([1, 2]))
# CHECK-L: bytes([97, 98])
print(b"ab")