MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / walk

Function walk

code2flow/javascript.py:24–43  ·  view source on GitHub ↗

Walk through the ast tree and return all nodes :param ast tree: :rtype: list[ast]

(tree)

Source from the content-addressed store, hash-verified

22
23
24def walk(tree):
25 """
26 Walk through the ast tree and return all nodes
27 :param ast tree:
28 :rtype: list[ast]
29 """
30 ret = []
31 if type(tree) == list:
32 for el in tree:
33 if el.get('type'):
34 ret.append(el)
35 ret += walk(el)
36 elif type(tree) == dict:
37 for k, v in tree.items():
38 if type(v) == dict and v.get('type'):
39 ret.append(v)
40 ret += walk(v)
41 if type(v) == list:
42 ret += walk(v)
43 return ret
44
45
46def resolve_owner(callee):

Callers 2

make_callsFunction · 0.70
make_local_variablesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected