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

Function get_call_from_send_el

code2flow/ruby.py:39–55  ·  view source on GitHub ↗

Given an ast that represents a send call, clear and create our generic Call object. Some calls have no chance at resolution (e.g. array[2](param)) so we return nothing instead. :param func_el ast: :rtype: Call|None

(func_el)

Source from the content-addressed store, hash-verified

37
38
39def get_call_from_send_el(func_el):
40 """
41 Given an ast that represents a send call, clear and create our
42 generic Call object. Some calls have no chance at resolution (e.g. array[2](param))
43 so we return nothing instead.
44
45 :param func_el ast:
46 :rtype: Call|None
47 """
48 owner_el = func_el[1]
49 token = func_el[2]
50 owner = resolve_owner(owner_el)
51 if owner and token == 'new':
52 # Taking out owner_token for constructors as a little hack to make it work
53 return Call(token=owner)
54 return Call(token=token,
55 owner_token=owner)
56
57
58def walk(tree_el):

Callers 2

make_callsFunction · 0.85
process_assignFunction · 0.85

Calls 2

CallClass · 0.85
resolve_ownerFunction · 0.70

Tested by

no test coverage detected