Address review: simplify template branch, add constructor comment

- Remove unnecessary TriggerForwarder.template() branch —
  TemplateArguments() already handles the empty case.
- Add comment on Automation default constructor explaining
  its purpose for the forwarder pattern.
This commit is contained in:
J. Nick Koston
2026-03-25 15:20:36 -10:00
parent 73ae0dd739
commit a90a2b1d62
2 changed files with 2 additions and 5 deletions
+1 -5
View File
@@ -700,9 +700,5 @@ async def build_callback_automation(
# one operator() per forwarder type; different automation pointers are just
# data in the struct.
if forwarder is None:
forwarder = (
TriggerForwarder.template(templ)
if arg_types
else TriggerForwarder.template()
)
forwarder = TriggerForwarder.template(templ)
cg.add(getattr(parent, callback_method)(cg.RawExpression(f"{forwarder}{{{obj}}}")))
+1
View File
@@ -470,6 +470,7 @@ template<typename... Ts> class ActionList {
template<typename... Ts> class Automation {
public:
/// Default constructor for use with TriggerForwarder (no Trigger object needed).
Automation() = default;
explicit Automation(Trigger<Ts...> *trigger) { trigger->set_automation_parent(this); }