diff options
| -rw-r--r-- | kconfiglib.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index b7274d7..15a5c1c 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2780,9 +2780,13 @@ class Symbol(Item, _HasVisibility): # Should the symbol get an entry in .config? self.write_to_conf = False - # Stores the calculated value to avoid unnecessary recalculation + # Caches the calculated value self.cached_value = None + # Caches the list of dependent symbols. Calculated the first time a + # user value is set on the symbol. + self.cached_deps = None + # Does the symbol have an entry in the Kconfig file? The Trailing # underscore avoids a collision with is_defined(). self.is_defined_ = False @@ -2928,6 +2932,10 @@ class Symbol(Item, _HasVisibility): def _get_dependent(self): """Returns the list of symbols that should be invalidated if the value of the symbol changes.""" + if self.cached_deps is not None: + return self.cached_deps + + # Calculate using a set to avoid duplicates in the result res = set() def rec(sym, ignore_choice = False): @@ -2948,7 +2956,8 @@ class Symbol(Item, _HasVisibility): rec(s, True) rec(self) - return res + self.cached_deps = list(res) + return self.cached_deps def _has_auto_menu_dep_on(self, on): """See Choice._determine_actual_items().""" |
