1
0
forked from VimPlug/jedi

Add a position modifier for the fast parser. Not yet in use though.

This commit is contained in:
Dave Halter
2015-01-15 13:57:56 +01:00
parent c963706418
commit cf223a71f5
6 changed files with 28 additions and 15 deletions

View File

@@ -106,7 +106,7 @@ def get_faked(module, obj, name=None):
# contain it).
doc = '"""%s"""' % obj.__doc__ # TODO need escapes.
suite = result.children[-1]
expr_stmt = pt.ExprStmt([pt.String(doc, (0, 0), '')])
expr_stmt = pt.ExprStmt([pt.String(pt.zero_position_modifier, doc, (0, 0), '')])
new_line = pt.Whitespace('\n', (0, 0), '')
docstr_node = pt.Node('simple_stmt', [expr_stmt, new_line])
suite.children.insert(2, docstr_node)

View File

@@ -158,8 +158,6 @@ def get_module_names(module, all_scopes):
class FakeSubModule():
line_offset = 0
parent = None
path = None
class FakeImport(pr.Import):
@@ -196,7 +194,7 @@ class FakeName(pr.Name):
In case is_definition is defined (not None), that bool value will be
returned.
"""
super(FakeName, self).__init__(name_str, start_pos)
super(FakeName, self).__init__(pr.zero_position_modifier, name_str, start_pos)
self.parent = parent
self._is_definition = is_definition

View File

@@ -260,7 +260,9 @@ class LazyInstanceDict(object):
class InstanceName(pr.Name):
def __init__(self, origin_name, parent):
super(InstanceName, self).__init__(origin_name.value, origin_name.start_pos)
super(InstanceName, self).__init__(origin_name.position_modifier,
origin_name.value,
origin_name.start_pos)
self._origin_name = origin_name
self.parent = parent