forked from VimPlug/jedi
Use PythonNode and not Node in the evaluator.
This commit is contained in:
@@ -10,7 +10,7 @@ import types
|
||||
|
||||
from jedi._compatibility import is_py3, builtins, unicode, is_py34
|
||||
from jedi.parser.python import parse
|
||||
from jedi.parser.python import tree as pt
|
||||
from jedi.parser.python import tree
|
||||
|
||||
modules = {}
|
||||
|
||||
@@ -180,9 +180,9 @@ def _get_faked(module, obj, name=None):
|
||||
assert result.type == 'funcdef'
|
||||
doc = '"""%s"""' % obj.__doc__ # TODO need escapes.
|
||||
suite = result.children[-1]
|
||||
string = pt.String(doc, (0, 0), '')
|
||||
new_line = pt.Newline('\n', (0, 0))
|
||||
docstr_node = pt.Node('simple_stmt', [string, new_line])
|
||||
string = tree.String(doc, (0, 0), '')
|
||||
new_line = tree.Newline('\n', (0, 0))
|
||||
docstr_node = tree.PythonNode('simple_stmt', [string, new_line])
|
||||
suite.children.insert(1, docstr_node)
|
||||
return result, fake_module
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ def _apply_decorators(evaluator, context, node):
|
||||
trailer_nodes = dec.children[2:-1]
|
||||
if trailer_nodes:
|
||||
# Create a trailer and evaluate it.
|
||||
trailer = tree.Node('trailer', trailer_nodes)
|
||||
trailer = tree.PythonNode('trailer', trailer_nodes)
|
||||
trailer.parent = dec
|
||||
dec_values = evaluator.eval_trailer(context, dec_values, trailer)
|
||||
|
||||
|
||||
@@ -230,8 +230,6 @@ class DiffParser(object):
|
||||
leaf = leaf.get_next_leaf()
|
||||
if leaf.get_start_pos_of_prefix()[0] == old_line:
|
||||
node = leaf
|
||||
# TODO use leaf.get_definition one day when that one is working
|
||||
# well.
|
||||
while node.parent.type not in ('file_input', 'suite'):
|
||||
node = node.parent
|
||||
return node
|
||||
|
||||
Reference in New Issue
Block a user