Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions code_generation/printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,10 @@ QString Printer::Private::classHeader(const Class &classObject, bool publicMembe
if (v.isStatic())
decl += "static ";

decl += formatType(v.type());

decl += v.name() + ';';
if (!v.isStatic() && v.initializer().isEmpty())
decl += v.name() + ';';
else
decl += v.name() + " = " + v.initializer() + ';';

code += decl;
}
Expand Down Expand Up @@ -361,16 +362,6 @@ QString Printer::Private::classImplementation(const Class &classObject, bool nes
&& f.name() == classObject.name()) {
inits.append(classObject.dPointerName() + "(new PrivateDPtr)");
}
if (!classObject.useDPointer() && f.name() == classObject.name()
&& f.arguments().isEmpty()) {
// Default constructor: add initializers for variables
for (itV = vars.constBegin(); itV != vars.constEnd(); ++itV) {
const MemberVariable v = *itV;
if (!v.initializer().isEmpty()) {
inits.append(v.name() + '(' + v.initializer() + ')');
}
}
}

if (!inits.isEmpty()) {
code.indent();
Expand Down