From 1fb6e157505a1d4872e16a9c49c92a98026485b8 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 8 Oct 2014 15:19:36 +0200 Subject: [PATCH] Fix prefixes of Leafs. --- jedi/parser/pytree.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jedi/parser/pytree.py b/jedi/parser/pytree.py index 054ae091..9f22b803 100644 --- a/jedi/parser/pytree.py +++ b/jedi/parser/pytree.py @@ -312,11 +312,12 @@ class Leaf(Base): """ assert 0 <= type < 256, type if context is not None: - self._prefix, (self.lineno, self.column) = context + self.prefix, (self.lineno, self.column) = context + if prefix is not None: + # The whitespace and comments preceding this token in the input. + self.prefix = prefix self.type = type self.value = value - # The whitespace and comments preceding this token in the input. - self.prefix = prefix or '' def __repr__(self): """Return a canonical string representation."""