Exemple #1
0
 def feedback_id(self, diagnostic=None):
     # instancie META!!!
     if len(self.infer_node.scope_node) > 1:
         final_scn = self.infer_node.scope_node
         final_scn = final_scn.get_by_return_type(self.final_type)
         self.infer_node.scope_node = final_scn
         if len(self.infer_node.scope_node) != 1:
             # ERROR TYPE !!!?!?
             diagnostic.notify(
                 Severity.ERROR,
                 ("Type error: too many candidates %s"
                     % str(self.infer_node.scope_node)),
                 self.info
             )
     else:
         the_sig = list(self.infer_node.scope_node.values())[0]
         if the_sig.tret.is_polymorphic:
             #                                 self.final_type)
             self.infer_node.type_node = EvalCtx.from_sig(the_sig)
             final_tn = self.infer_node.type_node
             final_tn.set_resolved_name(
                 self.map_type,
                 the_sig.tret,
                 self.final_type
             )
Exemple #2
0
 def infer_literal(self, args, diagnostic=None):
     """
     Infer type from an LITERAL!
     Type of literal depend of language.
     We adopt a basic convention
     """
     literal, t = args
     #self.type_node.add(EvalCtx.from_sig(Val(literal, t)))
     self.infer_node.scope_node.add(EvalCtx.from_sig(Val(literal, t)))
Exemple #3
0
 def infer_literal(self, args, diagnostic=None):
     """
     Infer type from an LITERAL!
     Type of literal depend of language.
     We adopt a basic convention
     """
     literal, t = args
     #self.type_node.add(EvalCtx.from_sig(Val(literal, t)))
     self.infer_node.scope_node.add(EvalCtx.from_sig(Val(literal, t)))
Exemple #4
0
 def feedback_id(self, diagnostic=None):
     # instancie META!!!
     if len(self.infer_node.scope_node) > 1:
         self.infer_node.scope_node = self.infer_node.scope_node.get_by_return_type(
             self.final_type)
         if len(self.infer_node.scope_node) != 1:
             # ERROR TYPE !!!?!?
             diagnostic.notify(
                 Severity.ERROR, "Type error: too many candidates %s" %
                 str(self.infer_node.scope_node), self.info)
     else:
         the_sig = list(self.infer_node.scope_node.values())[0]
         if the_sig.tret.is_polymorphic:
             #                                 self.final_type)
             self.infer_node.type_node = EvalCtx.from_sig(the_sig)
             self.infer_node.type_node.set_resolved_name(
                 self.map_type, the_sig.tret, self.final_type)