1. Create a new Alloy project.
2. Open views/index.xml and add a new Label element (e.g.) with an event hander that specifies a function that doesn't exist in the controller, e.g. <Label onClick="fooBar"></Label>.
3. Press Cmd+1/Ctrl+1 to open the 'Create event listener in controller file' dialog and press Enter to create the new handler.
4. Save all files and build for simulator/device.
Runtime error, "Can't find variable fooBar" (ios) or "fooBar is not defined" (Android).
Expected: No runtime error with generated event handler.
One fix is to add var before the function statement:
Or, to be consistent with the default Alloy template's onClick handler: