forked from M-Labs/artiq
transforms/inline: support catchall 'except' clauses
This commit is contained in:
parent
bad87ef38b
commit
e8c92c3b6f
|
@ -232,15 +232,16 @@ class _ReferenceReplacer(ast.NodeVisitor):
|
||||||
def visit_ExceptHandler(self, node):
|
def visit_ExceptHandler(self, node):
|
||||||
if node.name is not None:
|
if node.name is not None:
|
||||||
raise NotImplementedError("'as target' is not supported")
|
raise NotImplementedError("'as target' is not supported")
|
||||||
exception_class = self.rm.get(self.obj, self.func_name, node.type)
|
if node.type is not None:
|
||||||
if not inspect.isclass(exception_class):
|
exception_class = self.rm.get(self.obj, self.func_name, node.type)
|
||||||
raise NotImplementedError("Exception type must be a class")
|
if not inspect.isclass(exception_class):
|
||||||
exception_id = self.rm.exception_map[exception_class]
|
raise NotImplementedError("Exception type must be a class")
|
||||||
node.type = ast.copy_location(
|
exception_id = self.rm.exception_map[exception_class]
|
||||||
ast.Call(func=ast.Name("EncodedException", ast.Load()),
|
node.type = ast.copy_location(
|
||||||
args=[value_to_ast(exception_id)],
|
ast.Call(func=ast.Name("EncodedException", ast.Load()),
|
||||||
keywords=[], starargs=None, kwargs=None),
|
args=[value_to_ast(exception_id)],
|
||||||
node.type)
|
keywords=[], starargs=None, kwargs=None),
|
||||||
|
node.type)
|
||||||
self.generic_visit(node)
|
self.generic_visit(node)
|
||||||
return node
|
return node
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue