forked from VimPlug/jedi
start with the integration of an Operator class to make way for precedences
This commit is contained in:
@@ -166,6 +166,13 @@ class Evaluator(object):
|
||||
# The string tokens are just operations (+, -, etc.)
|
||||
elif isinstance(call, compiled.CompiledObject):
|
||||
result.append(call)
|
||||
elif isinstance(call, pr.Operator):
|
||||
if call == '*':
|
||||
if [r for r in result if isinstance(r, iterable.Array)
|
||||
or isinstance(r, compiled.CompiledObject)
|
||||
and isinstance(r.obj, (str, unicode))]:
|
||||
# if it is an iterable, ignore * operations
|
||||
next(calls_iterator)
|
||||
elif not isinstance(call, (str, unicode)):
|
||||
if isinstance(call, pr.Call) and str(call.name) == 'if':
|
||||
# Ternary operators.
|
||||
@@ -179,12 +186,6 @@ class Evaluator(object):
|
||||
break
|
||||
continue
|
||||
result += self.eval_call(call)
|
||||
elif call == '*':
|
||||
if [r for r in result if isinstance(r, iterable.Array)
|
||||
or isinstance(r, compiled.CompiledObject)
|
||||
and isinstance(r.obj, (str, unicode))]:
|
||||
# if it is an iterable, ignore * operations
|
||||
next(calls_iterator)
|
||||
return set(result)
|
||||
|
||||
def eval_call(self, call):
|
||||
|
||||
@@ -11,7 +11,7 @@ they change classes in Python 3.
|
||||
"""
|
||||
import copy
|
||||
|
||||
from jedi._compatibility import use_metaclass, unicode
|
||||
from jedi._compatibility import use_metaclass
|
||||
from jedi.parser import representation as pr
|
||||
from jedi import debug
|
||||
from jedi import common
|
||||
@@ -218,7 +218,7 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)):
|
||||
def expression_list(self):
|
||||
# Copy and modify the array.
|
||||
return [InstanceElement(self.instance._evaluator, self.instance, command, self.is_class_var)
|
||||
if not isinstance(command, unicode) else command
|
||||
if not isinstance(command, pr.Operator) else command
|
||||
for command in self.var.expression_list()]
|
||||
|
||||
def __iter__(self):
|
||||
|
||||
Reference in New Issue
Block a user