parameters: (self, env)
docstring: Interpret fused_cdef_func[specific_type1, ...]
  
          Note that if this method is called, we are an indexed cdef function
          with fused argument types, and this IndexNode will be replaced by the
          NameNode with specific entry just after analysis of expressions by
          AnalyseExpressionsTransform.
docstring_summary: Interpret fused_cdef_func[specific_type1, ...]
docstring_tokens: Interpret fused_cdef_func [ specific_type1 ... ]
function: def parse_indexed_fused_cdef(self, env):
          """
          Interpret fused_cdef_func[specific_type1, ...]
  
          Note that if this method is called, we are an indexed cdef function
          with fused argument types, and this IndexNode will be replaced by the
          NameNode with specific entry just after analysis of expressions by
          AnalyseExpressionsTransform.
          """
          self.type = PyrexTypes.error_type
  
          self.is_fused_index = True
  
          base_type = self.base.type
          positions = []
  
          if self.index.is_name or self.index.is_attribute:
              positions.append(self.index.pos)
          elif isinstance(self.index, TupleNode):
              for arg in self.index.args:
                  positions.append(arg.pos)
          specific_types = self.parse_index_as_types(env, required=False)
  
          if specific_types is None:
              self.index = self.index.analyse_types(env)
  
              if not self.base.entry.as_variable:
                  error(self.pos, "Can only index fused functions with types")
              else:
                  # A cpdef function indexed with Python objects
                  self.base.entry = self.entry = self.base.entry.as_variable
                  self.base.type = self.type = self.entry.type
  
                  self.base.is_temp = True
                  self.is_temp = True
  
                  self.entry.used = True
  
              self.is_fused_index = False
              return
  
          for i, type in enumerate(specific_types):
              specific_types[i] = type.specialize_fused(env)
  
          fused_types = base_type.get_fused_types()
          if len(specific_types) > len(fused_types):
              return error(self.pos, "Too many types specified")
          elif len(specific_types) < len(fused_types):
              t = fused_types[len(specific_types)]
              return error(self.pos, "Not enough types specified to specialize "
                                     "the function, %s is still fused" % t)
  
          # See if our index types form valid specializations
          for pos, specific_type, fused_type in zip(positions,
                                                    specific_types,
                                                    fused_types):
              if not any([specific_type.same_as(t) for t in fused_type.types]):
                  return error(pos, "Type not in fused type")
  
              if specific_type is None or specific_type.is_error:
                  return
  
          fused_to_specific = dict(zip(fused_types, specific_types))
          type = base_type.specialize(fused_to_specific)
  
          if type.is_fused:
              # Only partially specific, this is invalid
              error(self.pos,
                    "Index operation makes function only partially specific")
          else:
              # Fully specific, find the signature with the specialized entry
              for signature in self.base.type.get_all_specialized_function_types():
                  if type.same_as(signature):
                      self.type = signature
  
                      if self.base.is_attribute:
                          # Pretend to be a normal attribute, for cdef extension
                          # methods
                          self.entry = signature.entry
                          self.is_attribute = True
                          self.obj = self.base.obj
  
                      self.type.entry.used = True
                      self.base.type = signature
                      self.base.entry = signature.entry
  
                      break
              else:
                  # This is a bug
                  raise InternalError("Couldn't find the right signature")
function_tokens: def parse_indexed_fused_cdef ( self , env ) : self . type = PyrexTypes . error_type self . is_fused_index = True base_type = self . base . type positions = [ ] if self . index . is_name or self . index . is_attribute : positions . append ( self . index . pos ) elif isinstance ( self . index , TupleNode ) : for arg in self . index . args : positions . append ( arg . pos ) specific_types = self . parse_index_as_types ( env , required = False ) if specific_types is None : self . index = self . index . analyse_types ( env ) if not self . base . entry . as_variable : error ( self . pos , "Can only index fused functions with types" ) else : # A cpdef function indexed with Python objects self . base . entry = self . entry = self . base . entry . as_variable self . base . type = self . type = self . entry . type self . base . is_temp = True self . is_temp = True self . entry . used = True self . is_fused_index = False return for i , type in enumerate ( specific_types ) : specific_types [ i ] = type . specialize_fused ( env ) fused_types = base_type . get_fused_types ( ) if len ( specific_types ) > len ( fused_types ) : return error ( self . pos , "Too many types specified" ) elif len ( specific_types ) < len ( fused_types ) : t = fused_types [ len ( specific_types ) ] return error ( self . pos , "Not enough types specified to specialize " "the function, %s is still fused" % t ) # See if our index types form valid specializations for pos , specific_type , fused_type in zip ( positions , specific_types , fused_types ) : if not any ( [ specific_type . same_as ( t ) for t in fused_type . types ] ) : return error ( pos , "Type not in fused type" ) if specific_type is None or specific_type . is_error : return fused_to_specific = dict ( zip ( fused_types , specific_types ) ) type = base_type . specialize ( fused_to_specific ) if type . is_fused : # Only partially specific, this is invalid error ( self . pos , "Index operation makes function only partially specific" ) else : # Fully specific, find the signature with the specialized entry for signature in self . base . type . get_all_specialized_function_types ( ) : if type . same_as ( signature ) : self . type = signature if self . base . is_attribute : # Pretend to be a normal attribute, for cdef extension # methods self . entry = signature . entry self . is_attribute = True self . obj = self . base . obj self . type . entry . used = True self . base . type = signature self . base . entry = signature . entry break else : # This is a bug raise InternalError ( "Couldn't find the right signature" )