Collect all symbol names referenced anywhere in a Kconfig expression.
(expr)
| 145 | expr_str = kconfiglib.expr_str |
| 146 | |
| 147 | def _walk_expr(expr) -> list[str]: |
| 148 | """Collect all symbol names referenced anywhere in a Kconfig expression.""" |
| 149 | out: list[str] = [] |
| 150 | |
| 151 | def rec(e): |
| 152 | if isinstance(e, kconfiglib.Symbol): |
| 153 | if e.name and e.name != "y" and e.name != "n": |
| 154 | out.append(e.name) |
| 155 | elif isinstance(e, tuple): |
| 156 | for child in e[1:]: |
| 157 | rec(child) |
| 158 | |
| 159 | rec(expr) |
| 160 | return sorted(set(out)) |
| 161 | |
| 162 | # Pre-build a reverse-select index: target_symbol -> [symbols that `select` |
| 163 | # it]. Walking `sym.rev_dep` directly collects symbols from the condition |