(fn, strictDi, name)
| 3829 | } |
| 3830 | |
| 3831 | function annotate(fn, strictDi, name) { |
| 3832 | var $inject, |
| 3833 | argDecl, |
| 3834 | last; |
| 3835 | |
| 3836 | if (typeof fn === 'function') { |
| 3837 | if (!($inject = fn.$inject)) { |
| 3838 | $inject = []; |
| 3839 | if (fn.length) { |
| 3840 | if (strictDi) { |
| 3841 | if (!isString(name) || !name) { |
| 3842 | name = fn.name || anonFn(fn); |
| 3843 | } |
| 3844 | throw $injectorMinErr('strictdi', |
| 3845 | '{0} is not using explicit annotation and cannot be invoked in strict mode', name); |
| 3846 | } |
| 3847 | argDecl = extractArgs(fn); |
| 3848 | forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) { |
| 3849 | arg.replace(FN_ARG, function(all, underscore, name) { |
| 3850 | $inject.push(name); |
| 3851 | }); |
| 3852 | }); |
| 3853 | } |
| 3854 | fn.$inject = $inject; |
| 3855 | } |
| 3856 | } else if (isArray(fn)) { |
| 3857 | last = fn.length - 1; |
| 3858 | assertArgFn(fn[last], 'fn'); |
| 3859 | $inject = fn.slice(0, last); |
| 3860 | } else { |
| 3861 | assertArgFn(fn, 'fn', true); |
| 3862 | } |
| 3863 | return $inject; |
| 3864 | } |
| 3865 | |
| 3866 | /////////////////////////////////////// |
| 3867 |
nothing calls this directly
no test coverage detected