[TIMOB-25806] Hyperloop - iOS: Using ES6 arrow functions in Hyperloop-related code cannot be handled
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Resolved |
| Resolution | Fixed |
| Resolution Date | 2018-03-16T20:39:17.000+0000 |
| Affected Version/s | Hyperloop 3.1.0 |
| Fix Version/s | Hyperloop 3.1.0 |
| Components | Hyperloop |
| Labels | n/a |
| Reporter | Hans Knöchel |
| Assignee | Hans Knöchel |
| Created | 2018-02-24T18:21:09.000+0000 |
| Updated | 2018-03-21T19:05:05.000+0000 |
Description
When using ES6 in Hyperloop methods, e.g.
var ButtonDelegate = Hyperloop.defineClass('ButtonDelegate', 'NSObject');
ButtonDelegate.addMethod({
selector: 'buttonPressed:',
instance: true,
arguments: ['UIButton'],
callback: (sender) => {
// ^-- Here is the issue
}
});
the build fails:
[ERROR] An error occurred during build after 33s 538ms
[ERROR] not sure what to do with this node (/Users/hknoechel/Documents/Apps/hyperloop-examples/Resources/iphone/alloy/controllers/button.js:58:13)
The error is happening [here](https://github.com/appcelerator/hyperloop.next/blob/master/packages/hyperloop-ios-metabase/lib/generate/custom.js#L773) and looks like the arrow function cannot be mapped to the FunctionExpression and falls through.
PR: https://github.com/appcelerator/hyperloop.next/pull/272