mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 23:04:48 +08:00
Remove AnonymousFunctionExecution and simplify everything.
This commit is contained in:
@@ -145,16 +145,13 @@ def _evaluate_for_statement_string(module_context, string):
|
|||||||
except (AttributeError, IndexError):
|
except (AttributeError, IndexError):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
from jedi.evaluate.param import ValuesArguments
|
|
||||||
from jedi.evaluate.representation import FunctionContext
|
from jedi.evaluate.representation import FunctionContext
|
||||||
function_context = FunctionContext(
|
function_context = FunctionContext(
|
||||||
module_context.evaluator,
|
module_context.evaluator,
|
||||||
module_context,
|
module_context,
|
||||||
funcdef
|
funcdef
|
||||||
)
|
)
|
||||||
func_execution_context = function_context.get_function_execution(
|
func_execution_context = function_context.get_function_execution()
|
||||||
ValuesArguments([])
|
|
||||||
)
|
|
||||||
# Use the module of the param.
|
# Use the module of the param.
|
||||||
# TODO this module is not the module of the param in case of a function
|
# TODO this module is not the module of the param in case of a function
|
||||||
# call. In that case it's the module of the function call.
|
# call. In that case it's the module of the function call.
|
||||||
|
|||||||
@@ -267,9 +267,9 @@ class FunctionContext(use_metaclass(CachedMetaClass, context.TreeContext)):
|
|||||||
def get_function_execution(self, arguments=None):
|
def get_function_execution(self, arguments=None):
|
||||||
e = self.evaluator
|
e = self.evaluator
|
||||||
if arguments is None:
|
if arguments is None:
|
||||||
return AnonymousFunctionExecution(e, self.parent_context, self)
|
arguments = param.AnonymousArguments()
|
||||||
else:
|
|
||||||
return FunctionExecutionContext(e, self.parent_context, self, arguments)
|
return FunctionExecutionContext(e, self.parent_context, self, arguments)
|
||||||
|
|
||||||
def py__call__(self, arguments):
|
def py__call__(self, arguments):
|
||||||
function_execution = self.get_function_execution(arguments)
|
function_execution = self.get_function_execution(arguments)
|
||||||
@@ -420,14 +420,6 @@ class FunctionExecutionContext(context.TreeContext):
|
|||||||
return self.var_args.get_params(self)
|
return self.var_args.get_params(self)
|
||||||
|
|
||||||
|
|
||||||
class AnonymousFunctionExecution(FunctionExecutionContext):
|
|
||||||
def __init__(self, evaluator, parent_context, function_context):
|
|
||||||
super(AnonymousFunctionExecution, self).__init__(
|
|
||||||
evaluator, parent_context, function_context,
|
|
||||||
var_args=param.AnonymousArguments()
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ModuleAttributeName(AbstractNameDefinition):
|
class ModuleAttributeName(AbstractNameDefinition):
|
||||||
"""
|
"""
|
||||||
For module attributes like __file__, __str__ and so on.
|
For module attributes like __file__, __str__ and so on.
|
||||||
|
|||||||
Reference in New Issue
Block a user