diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-12 22:10:48 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-12 22:30:46 +0200 |
| commit | 8f6cb7a4ffd3731e85d78ebaba715efdfb849acd (patch) | |
| tree | 0914439d23ec11f4f1c4a9bd66c138f6306d7042 /kconfiglib.py | |
| parent | ffdb1a210c9854cf2e2467bf8a97ff894761a334 (diff) | |
Simplify expr_items()
Same cleanup as for _make_depend_on().
Rename 'deps' to 'res' as well. The result can be used for other stuff
besides figuring out dependencies.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index d480c96..e490d48 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -4425,23 +4425,23 @@ def expr_items(expr): expression 'expr'. """ - deps = set() + res = set() def rec(subexpr): - if not isinstance(subexpr, tuple): - # Symbol or choice - deps.add(subexpr) - - elif subexpr[0] == NOT: + if isinstance(subexpr, tuple): + # AND, OR, NOT or relation rec(subexpr[1]) + # NOTs only have a single operand + if subexpr[0] != NOT: + rec(subexpr[2]) + else: - # AND, OR, or relation - rec(subexpr[1]) - rec(subexpr[2]) + # Symbol or choice + res.add(subexpr) rec(expr) - return deps + return res def split_expr(expr, op): """ |
