From bef8fca57db44901be295b4b515a60b30aacb53e Mon Sep 17 00:00:00 2001 From: David Halter Date: Mon, 6 Aug 2012 21:26:05 +0200 Subject: [PATCH] list() builtin is working better now --- evaluate.py | 3 ++- test/completion/arrays.py | 2 +- test/completion/basic.py | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/evaluate.py b/evaluate.py index b2392788..fc84e768 100644 --- a/evaluate.py +++ b/evaluate.py @@ -937,7 +937,8 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False): and scope.var == name.parent.parent: name = InstanceElement(scope.instance, name) par = name.parent - if isinstance(par, parsing.Flow): + if isinstance(par, parsing.Flow) or isinstance(par, + InstanceElement) and isinstance(par.var, parsing.Flow) : if par.command == 'for': # Take the first statement (for has always only # one, remember `in`). And follow it. After that, diff --git a/test/completion/arrays.py b/test/completion/arrays.py index 43eb7704..df162d9f 100644 --- a/test/completion/arrays.py +++ b/test/completion/arrays.py @@ -187,7 +187,7 @@ GetItem("")[1] # conversions # ----------------- -#? str() +#? int() str() list([1,""])[1] #? str() diff --git a/test/completion/basic.py b/test/completion/basic.py index 5665d396..ebe449e1 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -24,6 +24,21 @@ for a4, (b4, c4) in (1,("", list)), (1,("", list)): #? list c4 +a = [] +for i in [1,'']: + a += [i] + +#? int() str() +a[0] + +a = [] +b = [1.0,''] +for i in b: + a += [i] + +#? float() str() +a[0] + # ----------------- # list comprehensions # -----------------