Skip to content

Commit 6a2515a

Browse files
committed
project reader: try to simplify code
Align variable names Remove superfluous loops Regroup code
1 parent d1a2203 commit 6a2515a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/pygccxml/parser/project_reader.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,7 @@ def __parse_file_by_file(self, files):
321321
self.logger.debug(
322322
"Cache has been flushed in %.1f secs",
323323
(timeit.default_timer() - start_time))
324-
namespaces = []
325-
self.logger.debug("Joining namespaces ...")
326-
for file_nss in namespaces:
327-
namespaces = self._join_top_namespaces(namespaces, file_nss)
328-
self.logger.debug("Joining declarations ...")
329-
for namespace in namespaces:
330-
if isinstance(namespace, pygccxml.declarations.namespace_t):
331-
declarations_joiner.join_declarations(namespace)
324+
namespaces = self.__join_namespaces_and_declarations(namespaces, namespaces)
332325
leaved_classes = self._join_class_hierarchy(namespaces)
333326
types = self.__declarated_types(namespaces)
334327
self.logger.debug("Relinking declared types ...")
@@ -354,7 +347,12 @@ def __parse_all_at_once(self, files):
354347
'#include "%s" %s' %
355348
(header, os.linesep))
356349
namespaces = self.read_string(''.join(header_content))
357-
namespaces = self._join_top_namespaces(namespaces, [])
350+
return self.__join_namespaces_and_declarations(namespaces, namespaces)
351+
352+
def __join_namespaces_and_declarations(self, main_ns_list, other_ns_list):
353+
self.logger.debug("Joining namespaces ...")
354+
namespaces = self._join_top_namespaces(main_ns_list, other_ns_list)
355+
self.logger.debug("Joining declarations ...")
358356
for namespace in namespaces:
359357
if isinstance(namespace, pygccxml.declarations.namespace_t):
360358
declarations_joiner.join_declarations(namespace)

0 commit comments

Comments
 (0)