Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed deprecated parameters from inits created by the RPC spec generator #1754

Merged
Merged
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
8 changes: 4 additions & 4 deletions generator/transformers/common_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, enum_names=(), struct_names=(), key_words=()):
'origin constructor_argument constructor_prefix deprecated mandatory since '
'method_suffix of_class type_native type_sdl modifier for_name description '
'constructor_argument_override')
self.constructor_named = namedtuple('constructor', 'init self arguments all deprecated')
self.constructor_named = namedtuple('constructor', 'init self arguments all')
self.argument_named = namedtuple('argument', 'origin constructor_argument variable deprecated')
self.names = self.struct_names + tuple(map(lambda e: self._replace_sync(e), enum_names))

Expand Down Expand Up @@ -215,8 +215,10 @@ def extract_constructors(self, data: dict) -> tuple:
"""
mandatory = []
not_mandatory = []
deprecated = any([m.deprecated for m in data.values() if getattr(m, 'deprecated', False)])
for param in data.values():
if param.deprecated:
# Omit deprecated parameters from the constructors
continue
if param.mandatory:
mandatory.append(param)
else:
Expand All @@ -225,13 +227,11 @@ def extract_constructors(self, data: dict) -> tuple:
result = []
if mandatory:
mandatory = self.extract_constructor(mandatory, True)
mandatory['deprecated'] = deprecated
else:
mandatory = OrderedDict()

if not_mandatory:
not_mandatory = self.extract_constructor(not_mandatory, False)
not_mandatory['deprecated'] = deprecated
if mandatory:
not_mandatory['init'] = '{} {}'.format(mandatory['init'], self.minimize_first(not_mandatory['init']))
not_mandatory['all'] = mandatory['arguments'] + not_mandatory['arguments']
Expand Down