nodes: 0, module; 1, function_definition; 2, function_name:resolve_symbols; 3, parameters; 4, block; 5, identifier:self; 6, identifier:tree; 7, identifier:database; 8, identifier:link_resolver; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, if_statement; 14, if_statement; 15, for_statement; 16, comment:# Always put symbols with no parent at the end; 17, expression_statement; 18, if_statement; 19, for_statement; 20, comment:"""
          When this method is called, the page's symbol names are queried
          from `database`, and added to lists of actual symbols, sorted
          by symbol class.
          """; 21, assignment; 22, assignment; 23, identifier:sym_name; 24, attribute; 25, block; 26, attribute; 27, block; 28, else_clause; 29, call; 30, block; 31, identifier:sym; 32, identifier:all_syms; 33, block; 34, assignment; 35, identifier:no_parent_syms; 36, block; 37, identifier:sym_type; 38, list; 39, block; 40, attribute; 41, call; 42, identifier:all_syms; 43, call; 44, identifier:self; 45, identifier:symbol_names; 46, expression_statement; 47, expression_statement; 48, attribute; 49, identifier:is_toplevel; 50, expression_statement; 51, block; 52, attribute; 53, argument_list; 54, expression_statement; 55, expression_statement; 56, expression_statement; 57, expression_statement; 58, identifier:no_parent_syms; 59, call; 60, expression_statement; 61, identifier:ClassSymbol; 62, identifier:AliasSymbol; 63, identifier:InterfaceSymbol; 64, identifier:StructSymbol; 65, expression_statement; 66, if_statement; 67, if_statement; 68, if_statement; 69, break_statement; 70, identifier:self; 71, identifier:typed_symbols; 72, attribute; 73, argument_list; 74, identifier:OrderedSet; 75, argument_list; 76, assignment; 77, call; 78, identifier:tree; 79, identifier:project; 80, assignment; 81, expression_statement; 82, attribute; 83, identifier:get; 84, string:"auto-sort"; 85, True; 86, assignment; 87, call; 88, call; 89, call; 90, attribute; 91, argument_list; 92, assignment; 93, assignment; 94, not_operator; 95, block; 96, comparison_operator:self.title is None; 97, block; 98, comparison_operator:self.comment is None; 99, block; 100, identifier:self; 101, identifier:__get_empty_typed_symbols; 102, identifier:sym; 103, call; 104, attribute; 105, argument_list; 106, identifier:page_path; 107, attribute; 108, assignment; 109, identifier:self; 110, identifier:meta; 111, identifier:all_syms; 112, call; 113, attribute; 114, argument_list; 115, attribute; 116, argument_list; 117, attribute; 118, argument_list; 119, attribute; 120, identifier:pop; 121, None; 122, None; 123, subscript; 124, identifier:no_parent_syms; 125, identifier:syms; 126, attribute; 127, identifier:syms; 128, continue_statement; 129, attribute; 130, None; 131, expression_statement; 132, attribute; 133, None; 134, expression_statement; 135, expression_statement; 136, expression_statement; 137, attribute; 138, argument_list; 139, identifier:self; 140, identifier:__query_extra_symbols; 141, identifier:sym; 142, identifier:all_syms; 143, identifier:tree; 144, identifier:link_resolver; 145, identifier:database; 146, attribute; 147, identifier:ref; 148, identifier:page_path; 149, binary_operator:self.project_name + '/' + self.link.ref; 150, identifier:sorted; 151, argument_list; 152, identifier:sym; 153, identifier:update_children_comments; 154, identifier:self; 155, identifier:__resolve_symbol; 156, identifier:sym; 157, identifier:link_resolver; 158, identifier:page_path; 159, attribute; 160, identifier:add; 161, attribute; 162, identifier:self; 163, identifier:by_parent_symbols; 164, attribute; 165, None; 166, subscript; 167, identifier:symbols; 168, identifier:self; 169, identifier:title; 170, assignment; 171, identifier:self; 172, identifier:comment; 173, assignment; 174, assignment; 175, assignment; 176, identifier:database; 177, identifier:get_symbol; 178, identifier:sym_name; 179, identifier:self; 180, identifier:link; 181, binary_operator:self.project_name + '/'; 182, attribute; 183, identifier:all_syms; 184, keyword_argument; 185, identifier:self; 186, identifier:symbol_names; 187, identifier:sym; 188, identifier:unique_name; 189, identifier:self; 190, identifier:by_parent_symbols; 191, attribute; 192, identifier:sym_type; 193, attribute; 194, attribute; 195, attribute; 196, call; 197, attribute; 198, attribute; 199, attribute; 200, attribute; 201, attribute; 202, string; 203, attribute; 204, identifier:ref; 205, identifier:key; 206, lambda; 207, identifier:self; 208, identifier:typed_symbols; 209, identifier:self; 210, identifier:title; 211, subscript; 212, identifier:display_name; 213, identifier:self; 214, identifier:comment; 215, identifier:Comment; 216, argument_list; 217, attribute; 218, identifier:short_description; 219, attribute; 220, identifier:short_description; 221, attribute; 222, identifier:title; 223, attribute; 224, identifier:title; 225, identifier:self; 226, identifier:project_name; 227, string_content:/; 228, identifier:self; 229, identifier:link; 230, lambda_parameters; 231, attribute; 232, identifier:syms; 233, integer:0; 234, keyword_argument; 235, identifier:self; 236, identifier:comment; 237, subscript; 238, identifier:comment; 239, identifier:self; 240, identifier:comment; 241, subscript; 242, identifier:comment; 243, identifier:x; 244, identifier:x; 245, identifier:unique_name; 246, identifier:name; 247, attribute; 248, identifier:syms; 249, integer:0; 250, identifier:syms; 251, integer:0; 252, identifier:self; 253, identifier:name
code: def resolve_symbols(self, tree, database, link_resolver):
          """
          When this method is called, the page's symbol names are queried
          from `database`, and added to lists of actual symbols, sorted
          by symbol class.
          """
          self.typed_symbols = self.__get_empty_typed_symbols()
          all_syms = OrderedSet()
          for sym_name in self.symbol_names:
              sym = database.get_symbol(sym_name)
              self.__query_extra_symbols(
                  sym, all_syms, tree, link_resolver, database)
  
          if tree.project.is_toplevel:
              page_path = self.link.ref
          else:
              page_path = self.project_name + '/' + self.link.ref
  
          if self.meta.get("auto-sort", True):
              all_syms = sorted(all_syms, key=lambda x: x.unique_name)
          for sym in all_syms:
              sym.update_children_comments()
              self.__resolve_symbol(sym, link_resolver, page_path)
              self.symbol_names.add(sym.unique_name)
  
          # Always put symbols with no parent at the end
          no_parent_syms = self.by_parent_symbols.pop(None, None)
          if no_parent_syms:
              self.by_parent_symbols[None] = no_parent_syms
  
          for sym_type in [ClassSymbol, AliasSymbol, InterfaceSymbol,
                           StructSymbol]:
              syms = self.typed_symbols[sym_type].symbols
  
              if not syms:
                  continue
  
              if self.title is None:
                  self.title = syms[0].display_name
              if self.comment is None:
                  self.comment = Comment(name=self.name)
                  self.comment.short_description = syms[
                      0].comment.short_description
                  self.comment.title = syms[0].comment.title
              break