diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-12 21:30:11 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-12 21:34:34 +0200 |
| commit | ffdb1a210c9854cf2e2467bf8a97ff894761a334 (patch) | |
| tree | bae582d3b8c0b28efaff37650226c8404ee953af | |
| parent | bf03762630dd67e82df8531cb7aae358b1b5a7da (diff) | |
Simplify _make_depend_on() some more
Rearrange and break out common stuff.
Already rename the 'sym' parameter to 'sc', as it could be a choice as
well.
| -rw-r--r-- | kconfiglib.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 29e0855..d480c96 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -4561,22 +4561,22 @@ def _visibility(sc): return vis -def _make_depend_on(sym, expr): - # Adds 'sym' as a dependency to all symbols in 'expr'. Constant symbols in - # 'expr' are skipped as they can never change value anyway. - - if not isinstance(expr, tuple): - # Symbol or choice - if not expr.is_constant: - expr._dependents.add(sym) - - elif expr[0] == NOT: - _make_depend_on(sym, expr[1]) - - else: - # AND, OR, or relation - _make_depend_on(sym, expr[1]) - _make_depend_on(sym, expr[2]) +def _make_depend_on(sc, expr): + # Adds 'sc' (symbol or choice) as a "dependee" to all symbols in 'expr'. + # Constant symbols in 'expr' are skipped as they can never change value + # anyway. + + if isinstance(expr, tuple): + # AND, OR, NOT or relation + _make_depend_on(sc, expr[1]) + + # NOTs only have a single operand + if expr[0] != NOT: + _make_depend_on(sc, expr[2]) + + elif not expr.is_constant: + # Non-constant symbol, or choice + expr._dependents.add(sc) def _expand(s): # A predefined UNAME_RELEASE symbol is expanded in one of the 'default's of |
