diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-24 13:33:28 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-24 21:49:52 +0200 |
commit | 0c8ada75b639ad8689d165ef617f25aeddfc16eb (patch) | |
tree | 3131e7f1422d618a99c6b7e2e7497807b20b1c01 /sources/shiboken2 | |
parent | d6d220b5d319b37d5940cc87ea615f8c1fb5e4eb (diff) |
shiboken2: Fix formatting of field getter code
Properly indent and join the else if statement.
Task-number: PYSIDE-1019
Change-Id: I8d5dc6c84e19b97b55f1ba29094da1e31dc7ca1c
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 2f76b6dbf..32b9cf24f 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -4470,11 +4470,16 @@ void CppGenerator::writeGetterFunction(QTextStream &s, << "reinterpret_cast<SbkObject *>(self), reinterpret_cast<SbkObjectType *>(" << cpythonTypeNameExt(fieldType) << ")));\n"; - s << INDENT << "if (pyOut) {Py_IncRef(pyOut); return pyOut;}\n"; + s << INDENT << "if (pyOut) {\n"; + { + Indentation indent(INDENT); + s << INDENT << "Py_IncRef(pyOut);\n" + << INDENT << "return pyOut;\n"; + } + s << INDENT << "}\n"; } - s << INDENT << "}\n"; // Check if field wrapper has already been created. - s << INDENT << "else if (Shiboken::BindingManager::instance().hasWrapper(" << cppField << ")) {" << "\n"; + s << INDENT << "} else if (Shiboken::BindingManager::instance().hasWrapper(" << cppField << ")) {" << "\n"; { Indentation indent(INDENT); s << INDENT << "pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(" |