Commit 903f11a5 authored by Xavier Thompson's avatar Xavier Thompson

Make __call__ work for cypclasses

parent 17b3b44a
......@@ -5756,6 +5756,7 @@ class SimpleCallNode(CallNode):
# rlocked bool used internally
# wlocked bool used internally
# tracked_state bool used internally
# needs_deref bool used internally
subexprs = ['self', 'coerced_self', 'function', 'args', 'arg_tuple']
......@@ -5771,6 +5772,7 @@ class SimpleCallNode(CallNode):
rlocked = False
wlocked = False
tracked_state = True # Something random, anything that is not None
needs_deref = False
def compile_time_value(self, denv):
function = self.function.compile_time_value(denv)
......@@ -5930,6 +5932,8 @@ class SimpleCallNode(CallNode):
entry.used = True
if not func_type.is_cpp_class:
self.function.entry = entry
elif func_type.is_cyp_class:
self.needs_deref = True
self.function.type = entry.type
func_type = self.function_type()
else:
......@@ -6191,6 +6195,8 @@ class SimpleCallNode(CallNode):
# argument. This is the opposite of self.self purpose.
if self.explicit_cpp_self:
result = "%s->%s(%s)" % (self.explicit_cpp_self, self.function.result(), ', '.join(arg_list_code))
elif self.needs_deref:
result = "(*%s)(%s)" % (self.function.result(), ', '.join(arg_list_code))
else:
result = "%s(%s)" % (self.function.result(), ', '.join(arg_list_code))
return result
......
......@@ -2786,7 +2786,8 @@ class CppClassScope(Scope):
'__lt__': '<',
'__gt__': '>',
'__le__': '<=',
'__ge__': '>='
'__ge__': '>=',
'__call__':'()'
}
def __init__(self, name, outer_scope, templates=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment