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

Function process_assign

code2flow/php.py:147–164  ·  view source on GitHub ↗

Given an assignment statement, return a Variable that points_to the type of object being assigned. :param assignment_el ast: :rtype: Variable

(assignment_el)

Source from the content-addressed store, hash-verified

145
146
147def process_assign(assignment_el):
148 """
149 Given an assignment statement, return a
150 Variable that points_to the type of object being assigned.
151
152 :param assignment_el ast:
153 :rtype: Variable
154 """
155 assert assignment_el['nodeType'] == 'Expr_Assign'
156 if 'name' not in assignment_el['var']:
157 return None
158
159 varname = assignment_el['var']['name']
160 call = get_call_from_expr(assignment_el['expr'])
161 if call:
162 return Variable(varname, call, line_number=lineno(assignment_el))
163 # else is something like `varname = num`
164 return None
165
166
167def make_local_variables(tree_el, parent):

Callers 1

make_local_variablesFunction · 0.70

Calls 3

get_call_from_exprFunction · 0.85
VariableClass · 0.85
linenoFunction · 0.70

Tested by

no test coverage detected