(self, node, visible_if)
| 3593 | # |
| 3594 | |
| 3595 | def _finalize_node(self, node, visible_if): |
| 3596 | # Finalizes a menu node and its children: |
| 3597 | # |
| 3598 | # - Copies properties from menu nodes up to their contained |
| 3599 | # symbols/choices |
| 3600 | # |
| 3601 | # - Propagates dependencies from parent to child nodes |
| 3602 | # |
| 3603 | # - Creates implicit menus (see kconfig-language.txt) |
| 3604 | # |
| 3605 | # - Removes 'if' nodes |
| 3606 | # |
| 3607 | # - Sets 'choice' types and registers choice symbols |
| 3608 | # |
| 3609 | # menu_finalize() in the C implementation is similar. |
| 3610 | # |
| 3611 | # node: |
| 3612 | # The menu node to finalize. This node and its children will have |
| 3613 | # been finalized when the function returns, and any implicit menus |
| 3614 | # will have been created. |
| 3615 | # |
| 3616 | # visible_if: |
| 3617 | # Dependencies from 'visible if' on parent menus. These are added to |
| 3618 | # the prompts of symbols and choices. |
| 3619 | |
| 3620 | if node.item.__class__ is Symbol: |
| 3621 | # Copy defaults, ranges, selects, and implies to the Symbol |
| 3622 | self._add_props_to_sym(node) |
| 3623 | |
| 3624 | # Find any items that should go in an implicit menu rooted at the |
| 3625 | # symbol |
| 3626 | cur = node |
| 3627 | while cur.next and _auto_menu_dep(node, cur.next): |
| 3628 | # This makes implicit submenu creation work recursively, with |
| 3629 | # implicit menus inside implicit menus |
| 3630 | self._finalize_node(cur.next, visible_if) |
| 3631 | cur = cur.next |
| 3632 | cur.parent = node |
| 3633 | |
| 3634 | if cur is not node: |
| 3635 | # Found symbols that should go in an implicit submenu. Tilt |
| 3636 | # them up above us. |
| 3637 | node.list = node.next |
| 3638 | node.next = cur.next |
| 3639 | cur.next = None |
| 3640 | |
| 3641 | elif node.list: |
| 3642 | # The menu node is a choice, menu, or if. Finalize each child node. |
| 3643 | |
| 3644 | if node.item is MENU: |
| 3645 | visible_if = self._make_and(visible_if, node.visibility) |
| 3646 | |
| 3647 | # Propagate the menu node's dependencies to each child menu node. |
| 3648 | # |
| 3649 | # This needs to go before the recursive _finalize_node() call so |
| 3650 | # that implicit submenu creation can look ahead at dependencies. |
| 3651 | self._propagate_deps(node, visible_if) |
| 3652 |
no test coverage detected