diff --git a/jedi/evaluate/helpers.py b/jedi/evaluate/helpers.py index b80f42d0..a013ab5c 100644 --- a/jedi/evaluate/helpers.py +++ b/jedi/evaluate/helpers.py @@ -5,7 +5,7 @@ from jedi.parser import representation as pr from jedi import debug -def fast_parent_copy(obj, new_elements_default=None): +def deep_ast_copy(obj, new_elements_default=None): """ Much, much faster than copy.deepcopy, but just for Parser elements (Doesn't copy parents). @@ -132,7 +132,7 @@ def search_call_signatures(user_stmt, position): call, arr, index = None, None, 0 if user_stmt is not None and isinstance(user_stmt, pr.Statement): # some parts will of the statement will be removed - user_stmt = fast_parent_copy(user_stmt) + user_stmt = deep_ast_copy(user_stmt) arr, index, call = call_signature_array_for_pos(user_stmt, position) # Now remove the part after the call. Including the array from the diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index 02cd0e91..5b128788 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -509,7 +509,7 @@ class FunctionExecution(Executed): """ def __init__(self, evaluator, base, *args, **kwargs): super(FunctionExecution, self).__init__(evaluator, base, *args, **kwargs) - # for fast_parent_copy + # for deep_ast_copy self._copy_dict = {base.base_func: self} @memoize_default(default=()) @@ -579,7 +579,7 @@ class FunctionExecution(Executed): objects = [] for element in lst: self._scope_copy(element.parent) - copied = helpers.fast_parent_copy(element, self._copy_dict) + copied = helpers.deep_ast_copy(element, self._copy_dict) objects.append(copied) return objects @@ -593,7 +593,7 @@ class FunctionExecution(Executed): if scope != self.base.base_func: # Just make sure the parents been copied. self._scope_copy(scope.parent) - helpers.fast_parent_copy(scope, self._copy_dict) + helpers.deep_ast_copy(scope, self._copy_dict) @common.safe_property @memoize_default([]) diff --git a/test/test_evaluate/test_helpers.py b/test/test_evaluate/test_helpers.py index 763a89b4..38c91267 100644 --- a/test/test_evaluate/test_helpers.py +++ b/test/test_evaluate/test_helpers.py @@ -1,10 +1,10 @@ -from jedi.evaluate.helpers import fast_parent_copy +from jedi.evaluate.helpers import deep_ast_copy from jedi.parser import representation as pr -def test_fast_parent_copy(): +def test_deep_ast_copy(): name = pr.Name(object, [('hallo', (0, 0))], (0, 0), (0, 0)) # fast parent copy should switch parent - new_name = fast_parent_copy(name) + new_name = deep_ast_copy(name) assert new_name.names[0].parent == new_name