Skip to content

Commit 03da4fb

Browse files
author
Andrew Schmadel
committed
fix function hoisting w/ nested array injects
fixes #29
1 parent 4927c7c commit 03da4fb

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

ng-annotate-main.js

+1
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ function insertArray(ctx, path) {
506506
t.arrayExpression(elems)
507507
)
508508
);
509+
path.scope.crawl();
509510

510511
}
511512

tests/issues.js

+21
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,27 @@ module.exports = {
219219
};
220220
},
221221
explicit: true
222+
},
223+
{
224+
name: "nested array injections w/ hoisting",
225+
input: function(){
226+
module.exports = function($filterProvider) {
227+
'ngInject';
228+
function ordinalSuffixFilter(ordinalSuffix) {
229+
'ngInject';
230+
}
231+
};
232+
},
233+
expected: function(){
234+
module.exports = ['$filterProvider', function($filterProvider) {
235+
'ngInject';
236+
ordinalSuffixFilter.$inject = ['ordinalSuffix'];
237+
function ordinalSuffixFilter(ordinalSuffix) {
238+
'ngInject';
239+
}
240+
}];
241+
},
242+
explicit: true
222243
}
223244
]
224245
}

0 commit comments

Comments
 (0)