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

Function get_name

code2flow/php.py:18–34  ·  view source on GitHub ↗

Get the name (token) of the AST node. :param tree ast: :rtype: str|None

(tree, from_='name')

Source from the content-addressed store, hash-verified

16
17
18def get_name(tree, from_='name'):
19 """
20 Get the name (token) of the AST node.
21 :param tree ast:
22 :rtype: str|None
23 """
24 # return tree['name']['name']
25 if 'name' in tree and isinstance(tree['name'], str):
26 return tree['name']
27
28 if 'parts' in tree:
29 return djoin(tree['parts'])
30
31 if from_ in tree:
32 return get_name(tree[from_])
33
34 return None
35
36
37def get_call_from_expr(func_expr):

Callers 2

get_call_from_exprFunction · 0.85
make_class_groupMethod · 0.85

Calls 1

djoinFunction · 0.85

Tested by

no test coverage detected