Given an ast tree get all children. For PHP, children are anything with a nodeType. :param tree_el ast: :rtype: list[ast]
(tree)
| 109 | |
| 110 | |
| 111 | def children(tree): |
| 112 | """ |
| 113 | Given an ast tree get all children. For PHP, children are anything |
| 114 | with a nodeType. |
| 115 | |
| 116 | :param tree_el ast: |
| 117 | :rtype: list[ast] |
| 118 | """ |
| 119 | assert isinstance(tree, dict) |
| 120 | ret = [] |
| 121 | for v in tree.values(): |
| 122 | if isinstance(v, list): |
| 123 | for el in v: |
| 124 | if isinstance(el, dict) and el.get('nodeType'): |
| 125 | ret.append(el) |
| 126 | elif isinstance(v, dict) and v.get('nodeType'): |
| 127 | ret.append(v) |
| 128 | return ret |
| 129 | |
| 130 | |
| 131 | def make_calls(body_el): |