mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
use weakrefs for parents now: rest
This commit is contained in:
@@ -55,7 +55,7 @@ def search_params(param):
|
||||
for params in listener.param_possibilities:
|
||||
for p in params:
|
||||
if str(p) == param_name:
|
||||
result += evaluate.follow_statement(p.parent)
|
||||
result += evaluate.follow_statement(p.parent())
|
||||
#print listener.param_possibilities, param, result
|
||||
|
||||
return result
|
||||
@@ -63,8 +63,8 @@ def search_params(param):
|
||||
func = param.get_parent_until(parsing.Function)
|
||||
current_module = param.get_parent_until()
|
||||
func_name = str(func.name)
|
||||
if func_name == '__init__' and isinstance(func.parent, parsing.Class):
|
||||
func_name = str(func.parent.name)
|
||||
if func_name == '__init__' and isinstance(func.parent(), parsing.Class):
|
||||
func_name = str(func.parent().name)
|
||||
|
||||
# get the param name
|
||||
if param.assignment_details:
|
||||
@@ -125,7 +125,7 @@ def _check_array_additions(compare_array, module, is_list):
|
||||
backtrack_path = iter(call_path[:separate_index])
|
||||
|
||||
position = c.parent_stmt.start_pos
|
||||
scope = c.parent_stmt.parent
|
||||
scope = c.parent_stmt.parent()
|
||||
e = evaluate.follow_call_path(backtrack_path, scope, position)
|
||||
if not compare_array in e:
|
||||
# the `append`, etc. belong to other arrays
|
||||
|
||||
@@ -946,6 +946,7 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
||||
and scope.var == name.parent().parent():
|
||||
name = InstanceElement(scope.instance, name)
|
||||
par = name.parent()
|
||||
print name, par
|
||||
if par.isinstance(parsing.Flow):
|
||||
if par.command == 'for':
|
||||
result += handle_for_loops(par)
|
||||
|
||||
@@ -61,7 +61,7 @@ class ImportPath(object):
|
||||
zero = (None, None)
|
||||
n = parsing.Name(i.namespace.names[1:], zero, zero)
|
||||
new = parsing.Import(zero, zero, n)
|
||||
new.parent = parent
|
||||
new.parent = lambda: parent
|
||||
debug.dbg('Generated a nested import: %s' % new)
|
||||
return new
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ class Scope(Simple):
|
||||
self.docstr = docstr
|
||||
|
||||
def add_scope(self, sub, decorators):
|
||||
print 'push scope @%s,%s' % sub.start_pos
|
||||
sub.parent = weakref.ref(self)
|
||||
sub.decorators = decorators
|
||||
for d in decorators:
|
||||
@@ -460,7 +459,6 @@ class Flow(Scope):
|
||||
else:
|
||||
self.next = next
|
||||
self.next.parent = self.parent
|
||||
print 'n', self.next
|
||||
#next.top_flow = self.top_flow
|
||||
return next
|
||||
|
||||
@@ -1349,8 +1347,8 @@ class PyFuzzyParser(object):
|
||||
token_type, tok = self.next()
|
||||
#debug.dbg('main: tok=[%s] type=[%s] indent=[%s]'\
|
||||
# % (tok, token_type, start_position[0]))
|
||||
print('main: tok=[%s] type=[%s] indent=[%s]'
|
||||
% (tok, tokenize.tok_name[token_type], self.start_pos[0]))
|
||||
#print('main: tok=[%s] type=[%s] indent=[%s]'
|
||||
# % (tok, tokenize.tok_name[token_type], self.start_pos[0]))
|
||||
|
||||
while token_type == tokenize.DEDENT \
|
||||
and self.scope != self.module:
|
||||
|
||||
Reference in New Issue
Block a user