Commit 9928cff1 authored by Mark Florisson's avatar Mark Florisson

Do not cast structures, memoryview slices or complex numbers

parent 169bf8a9
......@@ -3306,7 +3306,9 @@ class DefNodeWrapper(FuncDefNode):
if self.signature.has_dummy_arg:
args.append(Naming.self_cname)
for arg in self.args:
if arg.hdr_type and not (arg.type.is_memoryviewslice or arg.type.is_struct):
if arg.hdr_type and not (arg.type.is_memoryviewslice or
arg.type.is_struct or
arg.type.is_complex):
args.append(arg.type.cast_code(arg.entry.cname))
else:
args.append(arg.entry.cname)
......
......@@ -732,6 +732,8 @@ class MemoryViewSliceType(PyrexType):
if dtype is not self.dtype:
return MemoryViewSliceType(dtype, self.axes)
def cast_code(self, expr_code):
return expr_code
class BufferType(BaseType):
......@@ -1822,6 +1824,9 @@ class CComplexType(CNumericType):
def py_type_name(self):
return "complex"
def cast_code(self, expr_code):
return expr_code
complex_ops = {
(1, '-'): 'neg',
(1, 'zero'): 'is_zero',
......@@ -2860,6 +2865,11 @@ class CStructOrUnionType(CType):
for x in self.scope.var_entries]
return max(child_depths) + 1
def cast_code(self, expr_code):
if self.is_struct:
return expr_code
return super(CStructOrUnionType, self).cast_code(expr_code)
class CppClassType(CType):
# name string
# cname string
......
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