(fn, strictDi, name)
| 4240 | } |
| 4241 | |
| 4242 | function annotate(fn, strictDi, name) { |
| 4243 | var $inject, |
| 4244 | argDecl, |
| 4245 | last; |
| 4246 | |
| 4247 | if (typeof fn === 'function') { |
| 4248 | if (!($inject = fn.$inject)) { |
| 4249 | $inject = []; |
| 4250 | if (fn.length) { |
| 4251 | if (strictDi) { |
| 4252 | if (!isString(name) || !name) { |
| 4253 | name = fn.name || anonFn(fn); |
| 4254 | } |
| 4255 | throw $injectorMinErr('strictdi', |
| 4256 | '{0} is not using explicit annotation and cannot be invoked in strict mode', name); |
| 4257 | } |
| 4258 | argDecl = extractArgs(fn); |
| 4259 | forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) { |
| 4260 | arg.replace(FN_ARG, function(all, underscore, name) { |
| 4261 | $inject.push(name); |
| 4262 | }); |
| 4263 | }); |
| 4264 | } |
| 4265 | fn.$inject = $inject; |
| 4266 | } |
| 4267 | } else if (isArray(fn)) { |
| 4268 | last = fn.length - 1; |
| 4269 | assertArgFn(fn[last], 'fn'); |
| 4270 | $inject = fn.slice(0, last); |
| 4271 | } else { |
| 4272 | assertArgFn(fn, 'fn', true); |
| 4273 | } |
| 4274 | return $inject; |
| 4275 | } |
| 4276 | |
| 4277 | /////////////////////////////////////// |
| 4278 |
nothing calls this directly
no test coverage detected