From 4ac3bfb9f7e1452715c98c9e1a3d0dd1815a11ce Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Fri, 5 Jun 2015 07:10:49 +0200 Subject: _parse_block() style nit, take two. The menu must be added to self.menus before parsing its contents, so that it comes before any contained menus. Make the comment and menu cases consistent by rearranging the comment case instead. --- kconfiglib.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kconfiglib.py b/kconfiglib.py index 392148c..3bf6415 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1013,27 +1013,29 @@ class Config(object): elif t0 == T_COMMENT: comment = Comment() + comment.config = self comment.parent = parent - comment.filename = filename comment.linenr = linenr - comment.text = tokens.get_next() - self._parse_properties(line_feeder, comment, deps, visible_if_deps) - block.add_item(comment) self.comments.append(comment) + block.add_item(comment) + + self._parse_properties(line_feeder, comment, deps, visible_if_deps) elif t0 == T_MENU: menu = Menu() - self.menus.append(menu) + menu.config = self menu.parent = parent - menu.title = tokens.get_next() - menu.filename = filename menu.linenr = linenr + menu.title = tokens.get_next() + + self.menus.append(menu) + block.add_item(menu) # Parse properties and contents self._parse_properties(line_feeder, menu, deps, visible_if_deps) @@ -1044,8 +1046,6 @@ class Config(object): _make_and(visible_if_deps, menu.visible_if_expr)) - block.add_item(menu) - elif t0 == T_CHOICE: # We support named choices already_defined = False -- cgit v1.2.3