1
0
forked from VimPlug/jedi

Remove quite a bit of the old parser representation logic.

This commit is contained in:
Dave Halter
2014-11-23 19:26:30 +01:00
parent 0f21d38e2c
commit 9b54541cae
4 changed files with 9 additions and 236 deletions

View File

@@ -136,7 +136,6 @@ class Evaluator(object):
if seek_name:
types = finder.check_tuple_assignments(types, seek_name)
ass_details = stmt.assignment_details
first_operation = stmt.first_operation()
if first_operation not in ('=', None) and not isinstance(stmt, er.InstanceElement): # TODO don't check for this.
# `=` is always the last character in aug assignments -> -1

View File

@@ -159,7 +159,7 @@ class NameFinder(object):
# might still have conditions if defined outside of the
# current scope.
if isinstance(stmt, (pr.Param, pr.Import)) \
or isinstance(name_list_scope, (pr.Lambda, pr.ListComprehension, er.Instance, InterpreterNamespace)) \
or isinstance(name_list_scope, (pr.Lambda, er.Instance, InterpreterNamespace)) \
or isinstance(scope, compiled.CompiledObject):
# Always reachable.
names.append(name)
@@ -248,6 +248,9 @@ class NameFinder(object):
return True
def _name_is_array_assignment(self, name, stmt):
return False
# TODO DELETE this? or change it?
if stmt.isinstance(pr.ExprStmt):
def is_execution(calls):
for c in calls:
@@ -528,9 +531,6 @@ def get_names_of_scope(evaluator, scope, position=None, star_search=True, includ
:rtype: [(pr.Scope, [pr.Name])]
:return: Return an generator that yields a pair of scope and names.
"""
if isinstance(scope, pr.ListComprehension):
position = scope.parent.start_pos
in_func_scope = scope
non_flow = scope.get_parent_until(pr.Flow, reverse=True)
while scope:
@@ -554,9 +554,6 @@ def get_names_of_scope(evaluator, scope, position=None, star_search=True, includ
for g in scope.scope_names_generator(position):
yield g
if scope.isinstance(pr.ListComprehension):
# is a list comprehension
yield scope, scope.get_defined_names(is_internal_call=True)
scope = scope.parent
# This is used, because subscopes (Flow scopes) would distort the

View File

@@ -199,7 +199,8 @@ def search_call_signatures(user_stmt, position):
# Now remove the part after the call. Including the array from the
# statement.
stmt_el = call
while isinstance(stmt_el, pr.StatementElement):
# TODO REMOVE this? or change?
while False and isinstance(stmt_el, pr.StatementElement):
if stmt_el.next == arr:
stmt_el.next = None
break