Make sure execute_function_slots and get_function_slots is defined for all instances

This commit is contained in:
Dave Halter
2019-12-03 16:50:34 +01:00
parent 7254bec92c
commit e5d1091e80

View File

@@ -107,6 +107,16 @@ class AbstractInstanceValue(Value):
call_funcs = self.py__getattribute__('__call__').py__get__(self, self.class_value)
return [s.bind(self) for s in call_funcs.get_signatures()]
def get_function_slot_names(self, name):
# Searches for Python functions in classes.
return []
def execute_function_slots(self, names, *inferred_args):
return ValueSet.from_sets(
name.infer().execute_with_values(*inferred_args)
for name in names
)
def __repr__(self):
return "<%s of %s>" % (self.__class__.__name__, self.class_value)
@@ -286,12 +296,6 @@ class _BaseTreeInstance(AbstractInstanceValue):
return names
return []
def execute_function_slots(self, names, *inferred_args):
return ValueSet.from_sets(
name.infer().execute_with_values(*inferred_args)
for name in names
)
class TreeInstance(_BaseTreeInstance):
def __init__(self, inference_state, parent_context, class_value, arguments):