mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
replace name and statement end_pos (this way we can get rid of all that end_pos crap soon)
This commit is contained in:
@@ -860,6 +860,10 @@ class Statement(Simple, DocstringMixin):
|
|||||||
# cache
|
# cache
|
||||||
self._assignment_details = []
|
self._assignment_details = []
|
||||||
|
|
||||||
|
@property
|
||||||
|
def end_pos(self):
|
||||||
|
return self._token_list[-1].end_pos
|
||||||
|
|
||||||
def get_code(self, new_line=True):
|
def get_code(self, new_line=True):
|
||||||
def assemble(command_list, assignment=None):
|
def assemble(command_list, assignment=None):
|
||||||
pieces = [c.get_code() if isinstance(c, Simple) else c.string if
|
pieces = [c.get_code() if isinstance(c, Simple) else c.string if
|
||||||
@@ -1427,6 +1431,10 @@ class Name(Simple):
|
|||||||
""" Returns the names in a full string format """
|
""" Returns the names in a full string format """
|
||||||
return ".".join(unicode(n) for n in self.names)
|
return ".".join(unicode(n) for n in self.names)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def end_pos(self):
|
||||||
|
return self.names[-1].end_pos
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def docstr(self):
|
def docstr(self):
|
||||||
"""Return attribute docstring (PEP 257) if exists."""
|
"""Return attribute docstring (PEP 257) if exists."""
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ def test_module():
|
|||||||
name = module.name
|
name = module.name
|
||||||
assert str(name) == 'example'
|
assert str(name) == 'example'
|
||||||
assert name.start_pos == (0, 0)
|
assert name.start_pos == (0, 0)
|
||||||
assert name.end_pos == (0, 0)
|
assert name.end_pos == (0, 7)
|
||||||
|
|
||||||
module = Parser(u('asdf'), no_docstr=True).module
|
module = Parser(u('asdf'), no_docstr=True).module
|
||||||
name = module.name
|
name = module.name
|
||||||
|
|||||||
Reference in New Issue
Block a user