diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2015-06-13 21:05:09 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2015-06-13 21:06:09 +0200 |
| commit | 61bc2ac6b1a13cf27c656061d7fc1b28319bad7b (patch) | |
| tree | 3f79650f1e1ade093f9a5e21b645bcf9b72241a3 /kconfiglib.py | |
| parent | 3365ead94da6739fb4f10093df444f7c8cef9df1 (diff) | |
Bail early when a bool is selected to "m".
It will pin it to "y", meaning it's non-modifiable. No need to go on.
Maybe some common code should be extracted here too.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index a043a80..da0f588 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2053,9 +2053,9 @@ class Symbol(Item): if self.type != BOOL and self.type != TRISTATE: return None rev_dep = self.config._eval_expr(self.rev_dep) - # A bool selected to "m" gets promoted to "y" + # A bool selected to "m" gets promoted to "y", pinning it if rev_dep == "m" and self.type == BOOL: - rev_dep = "y" + return None vis = _get_visibility(self) if tri_to_int[vis] > tri_to_int[rev_dep]: return vis @@ -2076,9 +2076,9 @@ class Symbol(Item): if self.type != BOOL and self.type != TRISTATE: return None rev_dep = self.config._eval_expr(self.rev_dep) - # A bool selected to "m" gets promoted to "y" + # A bool selected to "m" gets promoted to "y", pinning it if rev_dep == "m" and self.type == BOOL: - rev_dep = "y" + return None if tri_to_int[_get_visibility(self)] > tri_to_int[rev_dep]: return rev_dep return None @@ -2099,9 +2099,9 @@ class Symbol(Item): if self.type != BOOL and self.type != TRISTATE: return [] rev_dep = self.config._eval_expr(self.rev_dep) - # A bool selected to "m" gets promoted to "y" + # A bool selected to "m" gets promoted to "y", pinning it if rev_dep == "m" and self.type == BOOL: - rev_dep = "y" + return [] res = ["n", "m", "y"][tri_to_int[rev_dep] : tri_to_int[_get_visibility(self)] + 1] return res if len(res) > 1 else [] @@ -2255,9 +2255,9 @@ class Symbol(Item): return False if self.type == BOOL or self.type == TRISTATE: rev_dep = self.config._eval_expr(self.rev_dep) - # A bool selected to "m" gets promoted to "y" + # A bool selected to "m" gets promoted to "y", pinning it if rev_dep == "m" and self.type == BOOL: - rev_dep = "y" + return False return tri_to_int[_get_visibility(self)] > tri_to_int[rev_dep] return _get_visibility(self) != "n" |
