forked from VimPlug/jedi
31 lines
804 B
Python
31 lines
804 B
Python
class Context(object):
|
|
type = None # TODO remove
|
|
|
|
def __init__(self, evaluator, parent_context=None):
|
|
self._evaluator = evaluator
|
|
self.parent_context = parent_context
|
|
|
|
def get_parent_flow_context(self):
|
|
return self.parent_context
|
|
|
|
def get_root_context(self):
|
|
context = self
|
|
while True:
|
|
if context.parent_context is None:
|
|
return context
|
|
context = context.parent_context
|
|
|
|
def execute(self, arguments=None):
|
|
return self._evaluator.execute(self, arguments)
|
|
|
|
|
|
class TreeContext(Context):
|
|
def eval_node(self, node):
|
|
return self._evaluator.eval_element(self, node)
|
|
|
|
|
|
class FlowContext(TreeContext):
|
|
def get_parent_flow_context(self):
|
|
if 1:
|
|
return self.parent_context
|