Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25806] Hyperloop - iOS: Using ES6 arrow functions in Hyperloop-related code cannot be handled

GitHub Issuen/a
TypeBug
PriorityCritical
StatusResolved
ResolutionFixed
Resolution Date2018-03-16T20:39:17.000+0000
Affected Version/sHyperloop 3.1.0
Fix Version/sHyperloop 3.1.0
ComponentsHyperloop
Labelsn/a
ReporterHans Knöchel
AssigneeHans Knöchel
Created2018-02-24T18:21:09.000+0000
Updated2018-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.

Comments

  1. Hans Knöchel 2018-02-24

    PR: https://github.com/appcelerator/hyperloop.next/pull/272

JSON Source