This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250898

Summary: Functions in IIFE are not always indexed
Product: javascript Reporter: Roman Svitanic <rsvitanic>
Component: EditorAssignee: Petr Pisl <ppisl>
Status: NEW ---    
Severity: normal CC: vriha
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: All   
See Also: https://netbeans.org/bugzilla/show_bug.cgi?id=246444
Issue Type: DEFECT Exception Reporter:

Description Roman Svitanic 2015-03-04 15:13:14 UTC
In following example

(function () {
    function Demo($scope) {
        $scope.text = 'Hello World!';
    }

    function IndexedDemo() {
        this.sample = 5;
    }
})();

function Demo is NOT indexed, but IndexedDemo is indexed.
This leads to an issue in AngularJS support (bug #246444).
Comment 1 Roman Svitanic 2015-03-04 15:54:32 UTC
Also function which is the second argument in the following sample is NOT indexed:
(function () {
    app.controller('DemoCtrl', function () {
        // This function is NOT indexed
        this.sample = 5;
    });     
})();

When the same function is named, then it IS indexed:
(function () {
    app.controller('DemoCtrl', function DemoCtrl() {
        // This function IS indexed
        this.sample = 5;
    });     
})();