diff --git a/evaluate.py b/evaluate.py index 964af997..1bbc59fb 100644 --- a/evaluate.py +++ b/evaluate.py @@ -110,7 +110,9 @@ class CachedMetaClass(type): class Executable(object): """ An instance is also an executable - because __init__ is called """ - def __init__(self, base, var_args=[]): + def __init__(self, base, var_args=parsing.Array(None, None)): + #if var_args == []: + # raise NotImplementedError() self.base = base # the param input array self.var_args = var_args @@ -428,13 +430,13 @@ class Execution(Executable): """ Create a param with the original scope (of varargs) as parent. """ - calls = parsing.Array(parsing.Array.NOARRAY, - self.var_args.parent_stmt) + parent_stmt = self.var_args.parent_stmt + calls = parsing.Array(parsing.Array.NOARRAY, parent_stmt) calls.values = values calls.keys = keys calls.type = array_type new_param = copy.copy(param) - new_param.parent = self.var_args.parent_stmt + new_param.parent = parent_stmt new_param._assignment_calls_calculated = True new_param._assignment_calls = calls name = copy.copy(param.get_name()) diff --git a/ftest.py b/ftest.py index 19a27f0d..558f2924 100755 --- a/ftest.py +++ b/ftest.py @@ -8,7 +8,7 @@ functions.debug.ignored_modules = ['parsing', 'builtin'] functions.modules.builtin.module_find_path.insert(0, '.') f_name = 'functions.py' -f_name = 'parsetest.py' +#f_name = 'parsetest.py' #f_name = 'test/completion/classes.py' import os path = os.path.join(os.getcwd(), f_name) @@ -16,8 +16,8 @@ path = os.path.join(os.getcwd(), f_name) f = open(path) code = f.read() for i in range(1): - completions = functions.complete(code, 15, 200, path) - #completions = functions.complete(code, 163, 200, path) + #completions = functions.complete(code, 15, 200, path) + completions = functions.complete(code, 164, 200, path) #completions = functions.get_definitions(code, 181, 2, path) #completions = functions.complete(code, 42, 200, path) diff --git a/functions.py b/functions.py index c6928bf2..22609ac1 100644 --- a/functions.py +++ b/functions.py @@ -6,7 +6,8 @@ import evaluate import modules import debug -__all__ = ['complete', 'goto', 'get_completion_parts', 'set_debug_function'] +__all__ = ['complete', 'get_completion_parts', 'get_definitions', + 'set_debug_function'] class NotFoundError(Exception): diff --git a/test/completion/functions.py b/test/completion/functions.py index bbe93324..146c7195 100644 --- a/test/completion/functions.py +++ b/test/completion/functions.py @@ -86,6 +86,8 @@ exe[1] #? int() func()[0] +#? str() +func()[1] #? float() func(1.0)[0] #? str() diff --git a/test/completion/thirdparty/jedi.py b/test/completion/thirdparty/jedi.py index 9ebb923b..5892efe2 100644 --- a/test/completion/thirdparty/jedi.py +++ b/test/completion/thirdparty/jedi.py @@ -1,5 +1,5 @@ -from jedi import functions +from jedi import functions, evaluate el = functions.complete()[0] #? ['description'] @@ -14,5 +14,8 @@ scopes, path, dot, like = \ source_path, True) # has problems with that (sometimes) very deep nesting. -#? str() +#? set() el = scopes. + +##? str() <--- recursion +el = evaluate.get_names_for_scope()[0].