Fix remaining issues with CompiledName.name change.

This commit is contained in:
Dave Halter
2014-09-03 19:47:37 +02:00
parent bb5ffe9343
commit f7a1c110ba
2 changed files with 5 additions and 5 deletions

View File

@@ -293,12 +293,12 @@ def _iterate_star_args(evaluator, array, expression_list, func):
elif isinstance(array, iterable.Generator): elif isinstance(array, iterable.Generator):
for field_stmt in array.iter_content(): for field_stmt in array.iter_content():
yield helpers.FakeStatement([field_stmt]) yield helpers.FakeStatement([field_stmt])
elif isinstance(array, Instance) and array.name == 'tuple': elif isinstance(array, Instance) and array.name.get_code() == 'tuple':
pass pass
else: else:
if expression_list: if expression_list:
m = "TypeError: %s() argument after * must be a sequence, not %s" \ m = "TypeError: %s() argument after * must be a sequence, not %s" \
% (func.name, array) % (func.name.get_code(), array)
analysis.add(evaluator, 'type-error-star', analysis.add(evaluator, 'type-error-star',
expression_list[0], message=m) expression_list[0], message=m)
@@ -306,7 +306,7 @@ def _iterate_star_args(evaluator, array, expression_list, func):
def _star_star_dict(evaluator, array, expression_list, func): def _star_star_dict(evaluator, array, expression_list, func):
dct = {} dct = {}
from jedi.evaluate.representation import Instance from jedi.evaluate.representation import Instance
if isinstance(array, Instance) and array.name == 'dict': if isinstance(array, Instance) and array.name.get_code() == 'dict':
# For now ignore this case. In the future add proper iterators and just # For now ignore this case. In the future add proper iterators and just
# make one call without crazy isinstance checks. # make one call without crazy isinstance checks.
return {} return {}
@@ -328,7 +328,7 @@ def _star_star_dict(evaluator, array, expression_list, func):
else: else:
if expression_list: if expression_list:
m = "TypeError: %s argument after ** must be a mapping, not %s" \ m = "TypeError: %s argument after ** must be a mapping, not %s" \
% (func.name, array) % (func.name.get_code(), array)
analysis.add(evaluator, 'type-error-star-star', analysis.add(evaluator, 'type-error-star-star',
expression_list[0], message=m) expression_list[0], message=m)
return dct return dct

View File

@@ -347,7 +347,7 @@ def _element_calculate(evaluator, left, operator, right):
def check(obj): def check(obj):
"""Checks if a Jedi object is either a float or an int.""" """Checks if a Jedi object is either a float or an int."""
return isinstance(obj, er.Instance) and obj.name in ('int', 'float') return isinstance(obj, er.Instance) and obj.name.get_code() in ('int', 'float')
# Static analysis, one is a number, the other one is not. # Static analysis, one is a number, the other one is not.
if operator in ('+', '-') and l_is_num != r_is_num \ if operator in ('+', '-') and l_is_num != r_is_num \