def op(self, inst): during = "Operation translate in %s" % (self.func.__name__, ) with error_context(lineno=inst.lineno, during="Translate operation", pyfunc=self.func): self.lineno = inst.lineno attr = 'op_%s' % inst.opname.replace('+', '_') fn = getattr(self, attr, self.generic_op) fn(inst)
def infer_node(cache, ctx, node, env, processed): """Infer types for a single node""" changed = False C = ctx.constraints.get(node, 'flow') if isinstance(node, Mono): typeset = set([node]) else: typeset = ctx.context[node] incoming = ctx.graph.predecessors(node) outgoing = ctx.graph.neighbors(node) # Get line number of original function if isinstance(node, ir.Op): lineno = node.metadata.get('lineno', -1) else: lineno = -1 with error_context(lineno=lineno, during="Infer call"): inferer = inference_table[C] return inferer(ctx, env, node, processed, incoming, typeset, changed)