forked from VimPlug/jedi
Remove dedents from the parser tree. No need for them.
This commit is contained in:
@@ -169,6 +169,12 @@ class Parser(object):
|
||||
try:
|
||||
new_node = Parser.AST_MAPPING[symbol](children)
|
||||
except KeyError:
|
||||
if symbol == 'suite':
|
||||
# We don't want the INDENT/DEDENT in our parser tree. Those
|
||||
# leaves are just cancer. They are virtual leaves and not real
|
||||
# ones and therefore have pseudo start/end positions and no
|
||||
# prefixes. Just ignore them.
|
||||
children = [children[0]] + children[2:-1]
|
||||
new_node = pt.Node(symbol, children)
|
||||
|
||||
# We need to check raw_node always, because the same node can be
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ class DocstringMixin(object):
|
||||
elif isinstance(self, ClassOrFunc):
|
||||
node = self.children[self.children.index(':') + 1]
|
||||
if is_node(node, 'suite'): # Normally a suite
|
||||
node = node.children[2] # -> NEWLINE INDENT stmt
|
||||
node = node.children[1] # -> NEWLINE stmt
|
||||
else: # ExprStmt
|
||||
simple_stmt = self.parent
|
||||
c = simple_stmt.parent.children
|
||||
|
||||
Reference in New Issue
Block a user