Skip to content
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
20 changes: 18 additions & 2 deletions obidog/bindings/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,16 @@ def generate_class_bindings(cpp_db: CppDatabase, class_value: ClassModel):
]
),
hooks="\n".join(
[generate_hook_calls(class_value, hook) for hook in class_value.flags.hooks]
# Generate hook calls and filter out None values
[
hook_call
for hook_call in [
hook.call
for hook in class_value.flags.hooks
if hook.trigger == ObidogHookTrigger.Bind
]
if hook_call
]
),
)
# TODO: Add shorthand
Expand Down Expand Up @@ -401,8 +410,15 @@ def apply_inherit_hook(classes: Dict[str, ClassModel]):
for hook in class_value.flags.hooks:
if hook.trigger == ObidogHookTrigger.Inherit:
for child_class in child_classes:
child_class_fqn = make_fqn(
name=child_class.name,
namespace=child_class.namespace,
)
child_class.flags.hooks |= {
ObidogHook(trigger=ObidogHookTrigger.Bind, call=hook.call)
ObidogHook(
trigger=ObidogHookTrigger.Bind,
call=hook.call.replace("%childclass%", child_class_fqn),
)
}


Expand Down