CMake: pro2cmake.py: Assign a unique id to each scope
This makes scopes much simpler to destinguish from each other. Change-Id: I1af42f181b5899aba749bcf9267a345385149f90 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
parent
0efd241d20
commit
cfbb110abe
@ -207,6 +207,9 @@ class RemoveOperation(Operation):
|
|||||||
|
|
||||||
|
|
||||||
class Scope(object):
|
class Scope(object):
|
||||||
|
|
||||||
|
SCOPE_ID: int = 1
|
||||||
|
|
||||||
def __init__(self, *,
|
def __init__(self, *,
|
||||||
parent_scope: typing.Optional[Scope],
|
parent_scope: typing.Optional[Scope],
|
||||||
file: typing.Optional[str] = None, condition: str = '',
|
file: typing.Optional[str] = None, condition: str = '',
|
||||||
@ -225,6 +228,8 @@ class Scope(object):
|
|||||||
if not self._basedir:
|
if not self._basedir:
|
||||||
self._basedir = self._currentdir
|
self._basedir = self._currentdir
|
||||||
|
|
||||||
|
self._scope_id = Scope.SCOPE_ID
|
||||||
|
Scope.SCOPE_ID += 1
|
||||||
self._file = file
|
self._file = file
|
||||||
self._condition = map_condition(condition)
|
self._condition = map_condition(condition)
|
||||||
self._children = [] # type: typing.List[Scope]
|
self._children = [] # type: typing.List[Scope]
|
||||||
@ -234,7 +239,7 @@ class Scope(object):
|
|||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
debug_mark = ' [MERGE_DEBUG]' if self.merge_debug else ''
|
debug_mark = ' [MERGE_DEBUG]' if self.merge_debug else ''
|
||||||
return '{}:{}:{}{}'.format(self._basedir, self._file,
|
return '{}:{}:{}:{}{}'.format(self._scope_id, self._basedir, self._file,
|
||||||
self._condition or '<NONE>', debug_mark)
|
self._condition or '<NONE>', debug_mark)
|
||||||
|
|
||||||
def reset_visited_keys(self):
|
def reset_visited_keys(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user