summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2019-12-17 23:35:40 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2019-12-17 23:42:34 +0100
commit9c0b562c947ca67bb02dd1b42b85f02a4f5acd76 (patch)
treeda5e2ba0ed6fa835d1705d171921682b8aac42b3
parent4ec909ffcc915d7dc182e38da4e6f4bce8065c05 (diff)
Pass 'node.item' instead of 'node' to Kconfig._set_type()
'node' isn't needed. Shaves some lookups.
-rw-r--r--kconfiglib.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 2712e66..05e41ab 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -3136,7 +3136,7 @@ class Kconfig(object):
if t0 in _TYPE_TOKENS:
# Relies on '_T_BOOL is BOOL', etc., to save a conversion
- self._set_type(node, t0)
+ self._set_type(node.item, t0)
if self._tokens[1] is not None:
self._parse_prompt(node)
@@ -3166,7 +3166,7 @@ class Kconfig(object):
self._parse_cond()))
elif t0 in _DEF_TOKEN_TO_TYPE:
- self._set_type(node, _DEF_TOKEN_TO_TYPE[t0])
+ self._set_type(node.item, _DEF_TOKEN_TO_TYPE[t0])
node.defaults.append((self._parse_expr(False),
self._parse_cond()))
@@ -3267,13 +3267,15 @@ class Kconfig(object):
self._reuse_tokens = True
return
- def _set_type(self, node, new_type):
+ def _set_type(self, sc, new_type):
+ # Sets the type of 'sc' (symbol or choice) to 'new_type'
+
# UNKNOWN is falsy
- if node.item.orig_type and node.item.orig_type is not new_type:
+ if sc.orig_type and sc.orig_type is not new_type:
self._warn("{} defined with multiple types, {} will be used"
- .format(node.item.name_and_loc, TYPE_TO_STR[new_type]))
+ .format(sc.name_and_loc, TYPE_TO_STR[new_type]))
- node.item.orig_type = new_type
+ sc.orig_type = new_type
def _parse_prompt(self, node):
# 'prompt' properties override each other within a single definition of