mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
fixed some position issues
This commit is contained in:
@@ -133,20 +133,20 @@ def get_names_of_scope(scope, position=None, star_search=True,
|
|||||||
... ''')
|
... ''')
|
||||||
>>> scope = parser.module.subscopes[0]
|
>>> scope = parser.module.subscopes[0]
|
||||||
>>> scope
|
>>> scope
|
||||||
<Function: func@3-6>
|
<Function: func@3-5>
|
||||||
|
|
||||||
`get_names_of_scope` is a generator. First it yields names from
|
`get_names_of_scope` is a generator. First it yields names from
|
||||||
most inner scope.
|
most inner scope.
|
||||||
|
|
||||||
>>> pairs = list(get_names_of_scope(scope))
|
>>> pairs = list(get_names_of_scope(scope))
|
||||||
>>> pairs[0]
|
>>> pairs[0]
|
||||||
(<Function: func@3-6>, [<Name: y@4,4>])
|
(<Function: func@3-5>, [<Name: y@4,4>])
|
||||||
|
|
||||||
Then it yield the names from one level outer scope. For this
|
Then it yield the names from one level outer scope. For this
|
||||||
example, this is the most outer scope.
|
example, this is the most outer scope.
|
||||||
|
|
||||||
>>> pairs[1]
|
>>> pairs[1]
|
||||||
(<SubModule: None@1-6>, [<Name: x@2,0>, <Name: func@3,4>])
|
(<SubModule: None@1-5>, [<Name: x@2,0>, <Name: func@3,4>])
|
||||||
|
|
||||||
Finally, it yields names from builtin, if `include_builtin` is
|
Finally, it yields names from builtin, if `include_builtin` is
|
||||||
true (default).
|
true (default).
|
||||||
|
|||||||
@@ -430,8 +430,8 @@ class Parser(object):
|
|||||||
except (StopIteration, common.MultiLevelStopIteration):
|
except (StopIteration, common.MultiLevelStopIteration):
|
||||||
# on finish, set end_pos correctly
|
# on finish, set end_pos correctly
|
||||||
s = self.scope
|
s = self.scope
|
||||||
while s is not None and (not isinstance(s, pr.Module)
|
while s is not None and not (isinstance(s, pr.Module)
|
||||||
and isinstance(s, pr.SubModule)):
|
and not isinstance(s, pr.SubModule)):
|
||||||
s.end_pos = self.end_pos
|
s.end_pos = self.end_pos
|
||||||
s = s.parent
|
s = s.parent
|
||||||
raise
|
raise
|
||||||
|
|||||||
Reference in New Issue
Block a user