diff --git a/evaluate.py b/evaluate.py index 98b169ab..03c8d6d2 100644 --- a/evaluate.py +++ b/evaluate.py @@ -7,6 +7,7 @@ follow_statement -> follow_call -> follow_paths -> follow_path TODO include super classes TODO nonlocal statement TODO doc +TODO list comprehensions, priority? """ from _compatibility import next @@ -347,7 +348,10 @@ def assign_tuples(tup, results, seek_name): def eval_results(index): types = [] for r in results: - types += r.get_exact_index_types(index) + if hasattr(r, "get_exact_index_types"): + types += r.get_exact_index_types(index) + else: + debug.warning("assign tuples: invalid tuple lookup") return types result = [] diff --git a/functions.py b/functions.py index f63cb318..ec718113 100644 --- a/functions.py +++ b/functions.py @@ -198,7 +198,8 @@ def complete(source, row, column, source_path): completions = [] debug.dbg('possible scopes', scopes) for s in scopes: - # TODO is this reall the right way, just ignore the functions? + # TODO is this reall the right way? just ignore the functions? \ + # do the magic functions first? and then recheck here? if not isinstance(s, parsing.Function): completions += s.get_defined_names() diff --git a/parsetest.py b/parsetest.py index 6c03d7ec..f500b8ed 100644 --- a/parsetest.py +++ b/parsetest.py @@ -128,13 +128,14 @@ if True or a: import time class c1(): c2,c5 = c1(), c1().c3() - def c3(self): + def c3(self, daeparam): import os as c4 #from parsing import Scope as c4 c5 = 1 c5 = c4( if 1: print 1 - return c5+'asdf' + #return c5+'asdf' + return daeparam (c1().c2.\ c, 1, c3()) [0].pop() c = u"asdf".join([1,2]) @@ -154,7 +155,6 @@ def globalfunc(): global globalvar, globalvar2 globalvar = 3 -for abcde, efgh in [(1,"")]: - abcde.real -abcde. + +c1().c3(1). diff --git a/test/completion/arrays.py b/test/completion/arrays.py index fc9b9a74..eda618a4 100644 --- a/test/completion/arrays.py +++ b/test/completion/arrays.py @@ -96,3 +96,19 @@ u1.real (u1).real #? [] u1.upper + +# ----------------- +# should fail +# ----------------- +(f, g) = (1,) +#? ['imag'] +f.imag +#? [] +g.upper + +(f1, g1) = 1 +#? [] +f1. +#? [] +g1. + diff --git a/test/completion/classes.py b/test/completion/classes.py index 9d7d062a..31ea1251 100644 --- a/test/completion/classes.py +++ b/test/completion/classes.py @@ -10,6 +10,9 @@ class TestClass(object): #? ['var_class', 'var_inst', 'var_local'] self.var_ + def ret(self, a1): + return a1 + inst = TestClass(1) #? ['var_class', 'var_inst', 'var_local'] @@ -17,3 +20,6 @@ inst.var #? ['var_class'] TestClass.var_class + +#? ['real'] +TestClass().ret(1).real diff --git a/test/run.py b/test/run.py index 8ebb1648..3391934f 100755 --- a/test/run.py +++ b/test/run.py @@ -35,7 +35,7 @@ def completion_test(source): completions = functions.complete(source, line_nr, 999, completion_test_dir) except: - print 'test: %s' % line + print 'test @%s: %s' % (line_nr, line) print traceback.format_exc() fails += 1 else: @@ -43,7 +43,7 @@ def completion_test(source): # TODO remove set! duplicates should not be normal comp_str = str(sorted(set([str(c) for c in completions]))) if comp_str != correct: - print 'Solution on %s not correct, received %s, wanted %s'\ + print 'Solution on @%s not correct, received %s, wanted %s'\ % (line_nr, comp_str, correct) #print [(c.name, c.name.parent) for c in completions] fails += 1