(fn, strictDi, name)
| 3990 | } |
| 3991 | |
| 3992 | function annotate(fn, strictDi, name) { |
| 3993 | var $inject, |
| 3994 | argDecl, |
| 3995 | last; |
| 3996 | |
| 3997 | if (typeof fn === 'function') { |
| 3998 | if (!($inject = fn.$inject)) { |
| 3999 | $inject = []; |
| 4000 | if (fn.length) { |
| 4001 | if (strictDi) { |
| 4002 | if (!isString(name) || !name) { |
| 4003 | name = fn.name || anonFn(fn); |
| 4004 | } |
| 4005 | throw $injectorMinErr('strictdi', |
| 4006 | '{0} is not using explicit annotation and cannot be invoked in strict mode', name); |
| 4007 | } |
| 4008 | argDecl = extractArgs(fn); |
| 4009 | forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) { |
| 4010 | arg.replace(FN_ARG, function(all, underscore, name) { |
| 4011 | $inject.push(name); |
| 4012 | }); |
| 4013 | }); |
| 4014 | } |
| 4015 | fn.$inject = $inject; |
| 4016 | } |
| 4017 | } else if (isArray(fn)) { |
| 4018 | last = fn.length - 1; |
| 4019 | assertArgFn(fn[last], 'fn'); |
| 4020 | $inject = fn.slice(0, last); |
| 4021 | } else { |
| 4022 | assertArgFn(fn, 'fn', true); |
| 4023 | } |
| 4024 | return $inject; |
| 4025 | } |
| 4026 | |
| 4027 | /////////////////////////////////////// |
| 4028 |
nothing calls this directly
no test coverage detected