All modules now have a code_lines attribute, see #1062

This commit is contained in:
Dave Halter
2018-03-16 10:20:14 +01:00
parent 24e1f7e6f0
commit 90a226f898
11 changed files with 102 additions and 33 deletions

View File

@@ -377,8 +377,7 @@ class BaseDefinition(object):
if self.in_builtin_module():
return ''
path = self._name.get_root_context().py__file__()
lines = parser_cache[self._evaluator.grammar._hashed][path].lines
lines = self._name.get_root_context().code_lines
index = self._name.start_pos[0] - 1
start_index = max(index - before, 0)