[ALOY-370] In order to assign functions to exports object in controller - you must declare a local function vs a variable assigned function
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2012-11-26T17:47:22.000+0000 |
Affected Version/s | Alloy 0.3.1 |
Fix Version/s | Alloy 0.3.3, 2012 Sprint 24 |
Components | n/a |
Labels | n/a |
Reporter | Bert Grantges |
Assignee | Unknown |
Created | 2012-11-07T18:53:51.000+0000 |
Updated | 2018-03-07T22:26:08.000+0000 |
Description
The below does not work:
var myFunc = function(){alert("hi there")};
exports.myFunc = myFunc;
The below works:
function myFunc2(){ alert("Hello Again")};
exports.myFunc2 = myFunc2;
The issues is during the code generation, Alloy doesn't recognized variable assigned functions the same way it recognizes local functions. The result is that the generated code to assign the exports object is actually placed before the variable assigned function statement, leading to an undefined exports property.
Required change in runtime controller composition. Test case works now, as do the alloy test apps that rely on this behavior.