From 5c911d9c43f0dc264058c3ecba7d7784d624928f Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 19 Mar 2018 21:44:56 +0100 Subject: Clean up _expr_depends_on() a bit 'left' is guaranteed to be 'sym' if the preceding conditional was true. --- kconfiglib.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/kconfiglib.py b/kconfiglib.py index 63d31a7..716afcc 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -4429,19 +4429,16 @@ def _expr_depends_on(expr, sym): if right is sym: left, right = right, left - - if left is not sym: + elif left is not sym: return False return (expr[0] == EQUAL and right is sym.kconfig.m or \ right is sym.kconfig.y) or \ (expr[0] == UNEQUAL and right is sym.kconfig.n) - if expr[0] == AND: - return _expr_depends_on(expr[1], sym) or \ - _expr_depends_on(expr[2], sym) - - return False + return expr[0] == AND and \ + (_expr_depends_on(expr[1], sym) or + _expr_depends_on(expr[2], sym)) def _auto_menu_dep(node1, node2): # Returns True if node2 has an "automatic menu dependency" on node1. If -- cgit v1.2.3