Skip to content

Commit 593ac63

Browse files
committed
if there is not promoter, we can't call the promoted functions
static methods can not use this->
1 parent 53feda3 commit 593ac63

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

generator/shellheadergenerator.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,10 @@ void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c
216216
if (fun->type()) {
217217
s << "return ";
218218
}
219-
// always do a direct call, since we want to call the real virtual function here
220-
s << "this->";
219+
if (!fun->isStatic()) {
220+
// always do a direct call, since we want to call the real virtual function here
221+
s << "this->";
222+
}
221223
s << fun->originalName() << "(";
222224
writePromoterArgs(args, s);
223225
s << "); }" << endl;
@@ -368,7 +370,7 @@ void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c
368370
Option(AddOwnershipTemplates | ConvertReferenceToPtr | FirstArgIsWrappedObject | IncludeDefaultExpression | OriginalName | ShowStatic | UnderscoreSpaces | ProtectedEnumAsInts));
369371
s << ";" << endl;
370372
}
371-
if (function->isVirtual()) {
373+
if (function->isVirtual() && meta_class->typeEntry()->shouldCreatePromoter()) {
372374
// qualified version that calls the promoter/the qualified version
373375
s << " ";
374376
writeFunctionSignature(s, function, 0, "py_q_",

0 commit comments

Comments
 (0)