Skip to content

Commit

Permalink
Class deprecations break method and ctor deprecations
Browse files Browse the repository at this point in the history
Method and ctor deprecations now properly override class deprecations.
  • Loading branch information
troopa81 authored and philthompson10 committed Dec 5, 2024
1 parent ed55769 commit 93369f6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions sipbuild/generator/resolver/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,8 @@ def _set_mro(spec, klass, error_log, seen=None):
if klass.scope is not None:
_set_mro(spec, klass.scope, error_log, seen=seen)

if klass.scope.deprecated:
klass.deprecated = True
if klass.scope.deprecated and not klass.deprecated:
klass.deprecated = klass.scope.deprecated

if klass.iface_file.type is IfaceFileType.CLASS:
# The first thing is itself.
Expand Down Expand Up @@ -687,8 +687,8 @@ def _set_mro(spec, klass, error_log, seen=None):
if klass.iface_file.module is spec.module:
superklass_mro.iface_file.needed = True

if superklass_mro.deprecated:
klass.deprecated = True
if superklass_mro.deprecated and not klass.deprecated:
klass.deprecated = superklass_mro.deprecated

# If the super-class is a QObject sub-class then this one is as
# well.
Expand Down Expand Up @@ -816,8 +816,9 @@ def _resolve_ctors(spec, klass, error_log):
klass.iface_file.fq_cpp_name))
break

if klass.deprecated:
ctor.deprecated = True

if klass.deprecated and not ctor.deprecated :
ctor.deprecated = klass.deprecated


def _transform_casts(spec, klass, error_log):
Expand Down Expand Up @@ -873,8 +874,8 @@ def _add_default_copy_ctor(klass):
ctor = Constructor(AccessSpecifier.PUBLIC, py_signature=signature,
cpp_signature=signature)

if klass.deprecated:
ctor.deprecated = True
if klass.deprecated and not ctor.deprecated :
ctor.deprecated = klass.deprecated

if not klass.is_abstract:
klass.can_create = True
Expand Down Expand Up @@ -919,8 +920,9 @@ def _resolve_scope_overloads(spec, overloads, error_log, final_checks,
break

if isinstance(scope, WrappedClass):
if scope.deprecated:
overload.deprecated = True

if scope.deprecated and not overload.deprecated :
overload.deprecated = scope.deprecated

if overload.is_abstract:
scope.is_abstract = True
Expand Down

0 comments on commit 93369f6

Please sign in to comment.