1
0
forked from VimPlug/jedi

CompiledObject.name returns a Name now, not a string. This is more consistent with the Jedi design and doesn't lead to bugs while ducktyping.

This commit is contained in:
Dave Halter
2014-09-03 19:43:21 +02:00
parent 18204c4c19
commit bb5ffe9343
5 changed files with 8 additions and 10 deletions

View File

@@ -188,12 +188,10 @@ class CompiledObject(Base):
pass # self.obj maynot have an __iter__ method.
return result
"""
@property
def name(self):
# might not exist sometimes (raises AttributeError)
return self._cls().obj.__name__
"""
return FakeName(self._cls().obj.__name__, self)
def _execute_function(self, evaluator, params):
if self.type() != 'function':

View File

@@ -213,7 +213,7 @@ def _literals_to_types(evaluator, result):
if is_literal(r):
# Literals are only valid as long as the operations are
# correct. Otherwise add a value-free instance.
cls = builtin.get_by_name(r.name)
cls = builtin.get_by_name(r.name.get_code())
result[i] = evaluator.execute(cls)[0]
return list(set(result))

View File

@@ -84,7 +84,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
"""
def __init__(self, evaluator, base, var_args=()):
super(Instance, self).__init__(evaluator, base, var_args)
if str(base.name) in ['list', 'set'] \
if base.name.get_code() in ['list', 'set'] \
and compiled.builtin == base.get_parent_until():
# compare the module path with the builtin name.
self.var_args = iterable.check_array_instances(evaluator, self)