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

Make __call__ work for cypclasses

parent 17b3b44a
...@@ -5756,6 +5756,7 @@ class SimpleCallNode(CallNode): ...@@ -5756,6 +5756,7 @@ class SimpleCallNode(CallNode):
# rlocked bool used internally # rlocked bool used internally
# wlocked bool used internally # wlocked bool used internally
# tracked_state bool used internally # tracked_state bool used internally
# needs_deref bool used internally
subexprs = ['self', 'coerced_self', 'function', 'args', 'arg_tuple'] subexprs = ['self', 'coerced_self', 'function', 'args', 'arg_tuple']
...@@ -5771,6 +5772,7 @@ class SimpleCallNode(CallNode): ...@@ -5771,6 +5772,7 @@ class SimpleCallNode(CallNode):
rlocked = False rlocked = False
wlocked = False wlocked = False
tracked_state = True # Something random, anything that is not None tracked_state = True # Something random, anything that is not None
needs_deref = False
def compile_time_value(self, denv): def compile_time_value(self, denv):
function = self.function.compile_time_value(denv) function = self.function.compile_time_value(denv)
...@@ -5930,6 +5932,8 @@ class SimpleCallNode(CallNode): ...@@ -5930,6 +5932,8 @@ class SimpleCallNode(CallNode):
entry.used = True entry.used = True
if not func_type.is_cpp_class: if not func_type.is_cpp_class:
self.function.entry = entry self.function.entry = entry
elif func_type.is_cyp_class:
self.needs_deref = True
self.function.type = entry.type self.function.type = entry.type
func_type = self.function_type() func_type = self.function_type()
else: else:
...@@ -6191,6 +6195,8 @@ class SimpleCallNode(CallNode): ...@@ -6191,6 +6195,8 @@ class SimpleCallNode(CallNode):
# argument. This is the opposite of self.self purpose. # argument. This is the opposite of self.self purpose.
if self.explicit_cpp_self: if self.explicit_cpp_self:
result = "%s->%s(%s)" % (self.explicit_cpp_self, self.function.result(), ', '.join(arg_list_code)) 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: else:
result = "%s(%s)" % (self.function.result(), ', '.join(arg_list_code)) result = "%s(%s)" % (self.function.result(), ', '.join(arg_list_code))
return result return result
......
...@@ -2786,7 +2786,8 @@ class CppClassScope(Scope): ...@@ -2786,7 +2786,8 @@ class CppClassScope(Scope):
'__lt__': '<', '__lt__': '<',
'__gt__': '>', '__gt__': '>',
'__le__': '<=', '__le__': '<=',
'__ge__': '>=' '__ge__': '>=',
'__call__':'()'
} }
def __init__(self, name, outer_scope, templates=None): 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