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

Function process_assign

code2flow/ruby.py:89–105  ·  view source on GitHub ↗

Given an assignment statement, return a Variable that points_to the type of object being assigned. The points_to is often a string but that is resolved later. :param assignment_el ast: :rtype: Variable

(assignment_el)

Source from the content-addressed store, hash-verified

87
88
89def process_assign(assignment_el):
90 """
91 Given an assignment statement, return a
92 Variable that points_to the type of object being assigned. The
93 points_to is often a string but that is resolved later.
94
95 :param assignment_el ast:
96 :rtype: Variable
97 """
98
99 assert assignment_el[0] == 'lvasgn'
100 varname = assignment_el[1]
101 if assignment_el[2][0] == 'send':
102 call = get_call_from_send_el(assignment_el[2])
103 return Variable(varname, call)
104 # else is something like `varname = num`
105 return None
106
107
108def make_local_variables(tree_el, parent):

Callers 1

make_local_variablesFunction · 0.70

Calls 2

get_call_from_send_elFunction · 0.85
VariableClass · 0.85

Tested by

no test coverage detected