Exemplo n.º 1
0
 def on_constant(self, node):
     """Generate code for a constant node."""
     if not self.has_constant(self.ref(node)):
         if node.is_constant(Primitive):
             self.on_function(
                 get_prim_graph(self.get_graph_cache(), node.value,
                                node.abstract),
                 node,
             )
         else:
             self.const_name_to_value[self.ref(node)] = self.make_const(
                 node.value, node.abstract)
         return None
Exemplo n.º 2
0
 def on_constant(self, node):
     """Convert a constant node."""
     if node.is_constant(Primitive):
         return self.convert_func(
             get_prim_graph({}, node.value, node.abstract))
     return self.make_const(node.value, node.abstract)