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

Function resolve_owner

code2flow/ruby.py:8–36  ·  view source on GitHub ↗

Resolve who owns the call, if anyone. So if the expression is i_ate.pie(). And i_ate is a Person, the callee is Person. This is returned as a string and eventually set to the owner_token in the call :param owner_el ast: :rtype: str|None

(owner_el)

Source from the content-addressed store, hash-verified

6
7
8def resolve_owner(owner_el):
9 """
10 Resolve who owns the call, if anyone.
11 So if the expression is i_ate.pie(). And i_ate is a Person, the callee is Person.
12 This is returned as a string and eventually set to the owner_token in the call
13
14 :param owner_el ast:
15 :rtype: str|None
16 """
17 if not owner_el or not isinstance(owner_el, list):
18 return None
19 if owner_el[0] == 'begin':
20 # skip complex ownership
21 return OWNER_CONST.UNKNOWN_VAR
22 if owner_el[0] == 'send':
23 # sends are complex too
24 return OWNER_CONST.UNKNOWN_VAR
25 if owner_el[0] == 'lvar':
26 # var.func()
27 return owner_el[1]
28 if owner_el[0] == 'ivar':
29 # @var.func()
30 return owner_el[1]
31 if owner_el[0] == 'self':
32 return 'self'
33 if owner_el[0] == 'const':
34 return owner_el[2]
35
36 return OWNER_CONST.UNKNOWN_VAR
37
38
39def get_call_from_send_el(func_el):

Callers 1

get_call_from_send_elFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected