1
0
forked from VimPlug/jedi

literal classes mostly working

This commit is contained in:
David Halter
2013-09-05 23:45:56 +04:30
parent fc5fdf929a
commit 1b5f4f5e0b
5 changed files with 20 additions and 22 deletions

View File

@@ -477,7 +477,7 @@ def check_getattr(inst, name_str):
result = []
# str is important to lose the NamePart!
module = builtin.Builtin.scope
name = pr.Call(module, str(name_str), pr.Call.STRING, (0, 0), (0, 0), inst)
name = pr.String(module, str(name_str), (0, 0), (0, 0), inst)
with common.ignored(KeyError):
result = inst.execute_subscope_by_name('__getattr__', [name])
if not result:
@@ -701,7 +701,7 @@ def follow_call(call):
def follow_call_path(path, scope, position):
"""Follows a path generated by `pr.Call.generate_call_path()`"""
"""Follows a path generated by `pr.StatementElement.generate_call_path()`"""
current = next(path)
if isinstance(current, pr.Array):
@@ -712,14 +712,10 @@ def follow_call_path(path, scope, position):
scopes = find_name(scope, current, position=position,
search_global=True)
else:
if current.type in (pr.Call.STRING, pr.Call.NUMBER):
t = type(current.name).__name__
scopes = find_name(builtin.Builtin.scope, t)
else:
debug.warning('unknown type:', current.type, current)
scopes = []
# for pr.Literal
scopes = find_name(builtin.Builtin.scope, current.type_as_string())
# Make instances of those number/string objects.
scopes = [er.Instance(s, (current.name,)) for s in scopes]
scopes = [er.Instance(s, (current.value,)) for s in scopes]
result = imports.strip_imports(scopes)
return follow_paths(path, result, scope, position=position)