diff options
-rw-r--r-- | generator/cppgenerator.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index f0c19e3ff..3ae270eb4 100644 --- a/generator/cppgenerator.cpp +++ b/generator/cppgenerator.cpp @@ -4108,11 +4108,10 @@ void CppGenerator::writeReturnValueHeuristics(QTextStream& s, const AbstractMeta void CppGenerator::writeHashFunction(QTextStream& s, const AbstractMetaClass* metaClass) { - s << "static long " << cpythonBaseName(metaClass) << "_HashFunc(PyObject* obj)"; - s << '{' << endl; + s << "static long " << cpythonBaseName(metaClass) << "_HashFunc(PyObject* self) {" << endl; + writeCppSelfDefinition(s, metaClass); s << INDENT << "return " << metaClass->typeEntry()->hashFunction() << '('; - writeToCppConversion(s, metaClass, "obj"); - s << ");" << endl; + s << (isObjectType(metaClass) ? "" : "*") << CPP_SELF_VAR << ");" << endl; s << '}' << endl << endl; } |