Commit 3d79fba4 authored by gsamain's avatar gsamain

Cypclass members access

parent 4136cc2c
...@@ -6907,7 +6907,7 @@ class AttributeNode(ExprNode): ...@@ -6907,7 +6907,7 @@ class AttributeNode(ExprNode):
else: else:
# Create a temporary entry describing the C method # Create a temporary entry describing the C method
# as an ordinary function. # as an ordinary function.
if entry.func_cname and not hasattr(entry.type, 'op_arg_struct'): if entry.func_cname and not hasattr(entry.type, 'op_arg_struct') and not type.is_cyp_class:
cname = entry.func_cname cname = entry.func_cname
if entry.type.is_static_method or ( if entry.type.is_static_method or (
env.parent_scope and env.parent_scope.is_cpp_class_scope): env.parent_scope and env.parent_scope.is_cpp_class_scope):
...@@ -6920,6 +6920,9 @@ class AttributeNode(ExprNode): ...@@ -6920,6 +6920,9 @@ class AttributeNode(ExprNode):
ctype = copy.copy(entry.type) ctype = copy.copy(entry.type)
ctype.args = ctype.args[:] ctype.args = ctype.args[:]
ctype.args[0] = PyrexTypes.CFuncTypeArg('self', type, 'self', None) ctype.args[0] = PyrexTypes.CFuncTypeArg('self', type, 'self', None)
elif type.is_cyp_class and entry.func_cname:
cname = entry.func_cname
ctype = entry.type
else: else:
cname = "%s->%s" % (type.vtabptr_cname, entry.cname) cname = "%s->%s" % (type.vtabptr_cname, entry.cname)
ctype = entry.type ctype = entry.type
...@@ -6930,6 +6933,7 @@ class AttributeNode(ExprNode): ...@@ -6930,6 +6933,7 @@ class AttributeNode(ExprNode):
ubcm_entry.scope = entry.scope ubcm_entry.scope = entry.scope
if type.is_cpp_class: if type.is_cpp_class:
ubcm_entry.overloaded_alternatives = [Symtab.Entry(entry.name, entry.func_cname, entry.type) for entry in entry.overloaded_alternatives] ubcm_entry.overloaded_alternatives = [Symtab.Entry(entry.name, entry.func_cname, entry.type) for entry in entry.overloaded_alternatives]
self.entry = ubcm_entry
return self.as_name_node(env, ubcm_entry, target=False) return self.as_name_node(env, ubcm_entry, target=False)
elif type.is_enum: elif type.is_enum:
if self.attribute in type.values: if self.attribute in type.values:
...@@ -7061,6 +7065,11 @@ class AttributeNode(ExprNode): ...@@ -7061,6 +7065,11 @@ class AttributeNode(ExprNode):
self.type = entry.type self.type = entry.type
self.member = entry.cname self.member = entry.cname
return return
elif entry.type.is_cpp_class and entry.is_type:
# This could be a c++ class trying to access a parent type
self.type = entry.type
self.member = entry.cname
return
else: else:
# If it's not a variable or C method, it must be a Python # If it's not a variable or C method, it must be a Python
# method of an extension type, so we treat it like a Python # method of an extension type, so we treat it like a Python
......
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