def flatten_compare(self, node):
if len(node.comparators) != 1:
raise ValueError("hatlog supports only 1 comparator")
if isinstance(node.ops[0], ast.Eq):
op = 'z_eq'
else:
op = 'z_cmp'
a = self.flatten(node.left)
b = self.flatten(node.comparators[0])
node_type = self.new_type()
self.nodes.append((op, [a, b], node_type))
return node_type
评论列表
文章目录