parameters: (self)
docstring: Initializes query optimizer state.
  
          There are 4 internals hash tables:
              1. from type to declarations
              2. from type to declarations for non-recursive queries
              3. from type to name to declarations
              4. from type to name to declarations for non-recursive queries
  
          Almost every query includes declaration type information. Also very
          common query is to search some declaration(s) by name or full name.
          Those hash tables allows to search declaration very quick.
docstring_summary: Initializes query optimizer state.
docstring_tokens: Initializes query optimizer state .
function: def init_optimizer(self):
          """
          Initializes query optimizer state.
  
          There are 4 internals hash tables:
              1. from type to declarations
              2. from type to declarations for non-recursive queries
              3. from type to name to declarations
              4. from type to name to declarations for non-recursive queries
  
          Almost every query includes declaration type information. Also very
          common query is to search some declaration(s) by name or full name.
          Those hash tables allows to search declaration very quick.
          """
          if self.name == '::':
              self._logger.debug(
                  "preparing data structures for query optimizer - started")
          start_time = timeit.default_timer()
  
          self.clear_optimizer()
  
          for dtype in scopedef_t._impl_all_decl_types:
              self._type2decls[dtype] = []
              self._type2decls_nr[dtype] = []
              self._type2name2decls[dtype] = {}
              self._type2name2decls_nr[dtype] = {}
  
          self._all_decls_not_recursive = self.declarations
          self._all_decls = make_flatten(
              self._all_decls_not_recursive)
          for decl in self._all_decls:
              types = self.__decl_types(decl)
              for type_ in types:
                  self._type2decls[type_].append(decl)
                  name2decls = self._type2name2decls[type_]
                  if decl.name not in name2decls:
                      name2decls[decl.name] = []
                  name2decls[decl.name].append(decl)
                  if self is decl.parent:
                      self._type2decls_nr[type_].append(decl)
                      name2decls_nr = self._type2name2decls_nr[type_]
                      if decl.name not in name2decls_nr:
                          name2decls_nr[decl.name] = []
                      name2decls_nr[decl.name].append(decl)
  
          for decl in self._all_decls_not_recursive:
              if isinstance(decl, scopedef_t):
                  decl.init_optimizer()
          if self.name == '::':
              self._logger.debug((
                  "preparing data structures for query optimizer - " +
                  "done( %f seconds ). "), (timeit.default_timer() - start_time))
          self._optimized = True
function_tokens: def init_optimizer ( self ) : if self . name == '::' : self . _logger . debug ( "preparing data structures for query optimizer - started" ) start_time = timeit . default_timer ( ) self . clear_optimizer ( ) for dtype in scopedef_t . _impl_all_decl_types : self . _type2decls [ dtype ] = [ ] self . _type2decls_nr [ dtype ] = [ ] self . _type2name2decls [ dtype ] = { } self . _type2name2decls_nr [ dtype ] = { } self . _all_decls_not_recursive = self . declarations self . _all_decls = make_flatten ( self . _all_decls_not_recursive ) for decl in self . _all_decls : types = self . __decl_types ( decl ) for type_ in types : self . _type2decls [ type_ ] . append ( decl ) name2decls = self . _type2name2decls [ type_ ] if decl . name not in name2decls : name2decls [ decl . name ] = [ ] name2decls [ decl . name ] . append ( decl ) if self is decl . parent : self . _type2decls_nr [ type_ ] . append ( decl ) name2decls_nr = self . _type2name2decls_nr [ type_ ] if decl . name not in name2decls_nr : name2decls_nr [ decl . name ] = [ ] name2decls_nr [ decl . name ] . append ( decl ) for decl in self . _all_decls_not_recursive : if isinstance ( decl , scopedef_t ) : decl . init_optimizer ( ) if self . name == '::' : self . _logger . debug ( ( "preparing data structures for query optimizer - " + "done( %f seconds ). " ) , ( timeit . default_timer ( ) - start_time ) ) self . _optimized = True