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:
@@ -105,7 +105,7 @@ export function createCdlEventHandlerSnippet(handler: CdlEventHandler): string {
|
||||
const globals = [
|
||||
...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) {
|
||||
lines.push(...globals.map((variable) => ` global ${variable}`), "")
|
||||
|
||||
Reference in New Issue
Block a user