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

Define (and correctly reference) the base type #239

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion cyclonedds/idl/_xt_builder.py
Expand Up @@ -406,6 +406,19 @@ def gather_types(cls, _type):

graph[my_node_name].add(scan_node_name)

if isclass(_ctype) and issubclass(_ctype, IdlStruct):
# get_extended_type_hints will not inspect the base type, which is a struct
base_type = _ctype.__base__
if base_type is None or base_type == IdlStruct:
pass
else:
scan_node_name = base_type.__idl_typename__.replace('.', '::')
if scan_node_name not in graph:
graph[scan_node_name] = set()
graph_types[scan_node_name] = base_type

graph[my_node_name].add(scan_node_name)

for name, fieldtype in get_extended_type_hints(_ctype).items():
m, deep = cls._deep_gather_type(fieldtype)
plain = cls._impl_xt_is_plain(fieldtype)
Expand Down Expand Up @@ -925,7 +938,7 @@ def _xt_complete_struct_header(cls, entity: Type[IdlStruct]) -> xt.CompleteStruc
)

return xt.CompleteStructHeader(
base_type=cls._xt_type_identifier("_base_", entity.__base__, True),
base_type=cls._xt_type_identifier("_base_", entity.__base__, False),
detail=cls._xt_complete_type_detail(entity)
)

Expand Down