mirror of https://github.com/m-labs/artiq.git
py2llvm: fix exception matching
This commit is contained in:
parent
af15f45bb9
commit
f7075b24f6
|
@ -299,14 +299,19 @@ class Visitor:
|
||||||
else:
|
else:
|
||||||
if isinstance(handler.type, ast.Tuple):
|
if isinstance(handler.type, ast.Tuple):
|
||||||
match = self.builder.icmp(
|
match = self.builder.icmp(
|
||||||
lc.ICMP_EQ, eid, handler.type.elts[0].args[0].n)
|
lc.ICMP_EQ, eid,
|
||||||
|
lc.Constant.int(lc.Type.int(),
|
||||||
|
handler.type.elts[0].args[0].n))
|
||||||
for elt in handler.type.elts[1:]:
|
for elt in handler.type.elts[1:]:
|
||||||
match = self.builder.or_(
|
match = self.builder.or_(
|
||||||
match,
|
match,
|
||||||
self.builder.icmp(lc.ICMP_EQ, eid, elt.args[0].n))
|
self.builder.icmp(
|
||||||
|
lc.ICMP_EQ, eid,
|
||||||
|
lc.Constant.int(lc.Type.int(), elt.args[0].n)))
|
||||||
else:
|
else:
|
||||||
match = self.builder.icmp(
|
match = self.builder.icmp(
|
||||||
lc.ICMP_EQ, eid, handler.type.args[0].n)
|
lc.ICMP_EQ, eid,
|
||||||
|
lc.Constant.int(lc.Type.int(), handler.type.args[0].n))
|
||||||
self.builder.cbranch(match, handled_exc_block, cont_exc_block)
|
self.builder.cbranch(match, handled_exc_block, cont_exc_block)
|
||||||
self.builder.position_at_end(handled_exc_block)
|
self.builder.position_at_end(handled_exc_block)
|
||||||
self.builder.store(lc.Constant.int(lc.Type.int(1), 0), propagate)
|
self.builder.store(lc.Constant.int(lc.Type.int(1), 0), propagate)
|
||||||
|
|
Loading…
Reference in New Issue