diff --git a/evaluate.py b/evaluate.py index 022968e3..19a054d5 100644 --- a/evaluate.py +++ b/evaluate.py @@ -661,6 +661,11 @@ class Generator(object): return self.func.parent #self.execution.get_return_types() + def get_index_types(self, index): + # TODO check if this method is right here, this means that Generators + # can be indexed, which is not the Python way. + return Execution(self.func).get_return_types(True) + def __repr__(self): return "<%s of %s>" % (self.__class__.__name__, self.func) diff --git a/functions.py b/functions.py index 567eafa9..5706f5d8 100644 --- a/functions.py +++ b/functions.py @@ -160,6 +160,7 @@ def complete(source, row, column, source_path): if not isinstance(s, evaluate.Function): completions += s.get_defined_names() + #completions[0]. completions = [c for c in completions if c.names[-1].lower().startswith(like.lower())] diff --git a/test/completion/functions.py b/test/completion/functions.py index e3c96f3b..bbe93324 100644 --- a/test/completion/functions.py +++ b/test/completion/functions.py @@ -173,21 +173,3 @@ exe[3].items #? set() exe[3]['c'] -# ----------------- -# generators -# ----------------- - -def gen(): - yield 1 - yield "" - -gen_exe = gen() -#? ['upper'] -next(gen_exe).upper -#? ['real'] -next(gen_exe).real -#? int() str() -next(gen_exe) - -#? int() str() list -next(gen_exe, list) diff --git a/test/completion/generators.py b/test/completion/generators.py new file mode 100644 index 00000000..2c6121c5 --- /dev/null +++ b/test/completion/generators.py @@ -0,0 +1,32 @@ +# ----------------- +# yield statement +# ----------------- + +def gen(): + yield 1 + yield "" + +gen_exe = gen() +#? ['upper'] +next(gen_exe).upper +#? ['real'] +next(gen_exe).real +#? int() str() +next(gen_exe) + +#? int() str() list +next(gen_exe, list) + +# ----------------- +# generators should be indexable? +# ----------------- +def get(self): + yield 1 + yield "" + +arr = [] +for a in arr: + arr += get() + +#? int() str() +arr[0].