1
0
forked from VimPlug/jedi

scan_statement -> scan_statement_for_calls

This commit is contained in:
Dave Halter
2014-01-07 15:10:19 +01:00
parent 359f3ed4a9
commit a74b7299e2
4 changed files with 8 additions and 8 deletions

View File

@@ -766,7 +766,7 @@ def usages(evaluator, definitions, search_name, mods):
if set(f) & set(definitions): if set(f) & set(definitions):
names.append(api_classes.Usage(evaluator, name_part, stmt)) names.append(api_classes.Usage(evaluator, name_part, stmt))
else: else:
for call in helpers.scan_statement(stmt, search_name, for call in helpers.scan_statements(stmt, search_name,
assignment_details=True): assignment_details=True):
names += check_call(call) names += check_call(call)
return names return names

View File

@@ -103,7 +103,7 @@ def search_params(evaluator, param):
for stmt in possible_stmts: for stmt in possible_stmts:
if isinstance(stmt, pr.Import): if isinstance(stmt, pr.Import):
continue continue
calls = helpers.scan_statement(stmt, func_name) calls = helpers.scan_statement_for_calls(stmt, func_name)
for c in calls: for c in calls:
# no execution means that params cannot be set # no execution means that params cannot be set
call_path = list(c.generate_call_path()) call_path = list(c.generate_call_path())

View File

@@ -170,17 +170,17 @@ def search_call_signatures(stmt, pos):
return None, 0, False return None, 0, False
def scan_statement(stmt, search_name, assignment_details=False): def scan_statement_for_calls(stmt, search_name, assignment_details=False):
""" Returns the function Call that match search_name in an Array. """ """ Returns the function Calls that match search_name in an Array. """
def scan_array(arr, search_name): def scan_array(arr, search_name):
result = [] result = []
if arr.type == pr.Array.DICT: if arr.type == pr.Array.DICT:
for key_stmt, value_stmt in arr.items(): for key_stmt, value_stmt in arr.items():
result += scan_statement(key_stmt, search_name) result += scan_statement_for_calls(key_stmt, search_name)
result += scan_statement(value_stmt, search_name) result += scan_statement_for_calls(value_stmt, search_name)
else: else:
for stmt in arr: for stmt in arr:
result += scan_statement(stmt, search_name) result += scan_statement_for_calls(stmt, search_name)
return result return result
check = list(stmt.expression_list()) check = list(stmt.expression_list())

View File

@@ -330,7 +330,7 @@ def _check_array_additions(evaluator, compare_array, module, is_list):
# check recursion # check recursion
continue continue
res += check_calls(helpers.scan_statement(stmt, n), n) res += check_calls(helpers.scan_statement_for_calls(stmt, n), n)
evaluator.recursion_detector.pop_stmt() evaluator.recursion_detector.pop_stmt()
# reset settings # reset settings
settings.dynamic_params_for_other_modules = temp_param_add settings.dynamic_params_for_other_modules = temp_param_add