1
0
forked from VimPlug/jedi

start with the integration of an Operator class to make way for precedences

This commit is contained in:
Dave Halter
2014-02-26 14:44:51 +01:00
parent e152939791
commit 2e12eb7861
5 changed files with 60 additions and 45 deletions

View File

@@ -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):

View File

@@ -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):