feat(cdl): include args in generated event handler snippet

The generated event handler snippet now declares the proc with an args block.
This enables parameters to be referenced within the handler body.
The change makes the snippet compatible with events that pass arguments.

- Include an args block in the proc declaration for event handlers.
This commit is contained in:
Christoph Brandau
2026-09-10 08:45:25 +02:00
parent b7f28ab1a3
commit 7e9a4359cd
+1 -1
View File
@@ -105,7 +105,7 @@ export function createCdlEventHandlerSnippet(handler: CdlEventHandler): string {
const globals = [ const globals = [
...new Set(handler.parameterNames.map((parameter) => momVariableName(parameter))) ...new Set(handler.parameterNames.map((parameter) => momVariableName(parameter)))
] ]
const lines = [`proc ${momEventName(handler.eventName)} { } {`] const lines = [`proc ${momEventName(handler.eventName)} {args} {`]
if (globals.length > 0) { if (globals.length > 0) {
lines.push(...globals.map((variable) => ` global ${variable}`), "") lines.push(...globals.map((variable) => ` global ${variable}`), "")