(fn, strictDi, name)
| 4262 | } |
| 4263 | |
| 4264 | function annotate(fn, strictDi, name) { |
| 4265 | var $inject, |
| 4266 | argDecl, |
| 4267 | last; |
| 4268 | |
| 4269 | if (typeof fn === 'function') { |
| 4270 | if (!($inject = fn.$inject)) { |
| 4271 | $inject = []; |
| 4272 | if (fn.length) { |
| 4273 | if (strictDi) { |
| 4274 | if (!isString(name) || !name) { |
| 4275 | name = fn.name || anonFn(fn); |
| 4276 | } |
| 4277 | throw $injectorMinErr('strictdi', |
| 4278 | '{0} is not using explicit annotation and cannot be invoked in strict mode', name); |
| 4279 | } |
| 4280 | argDecl = extractArgs(fn); |
| 4281 | forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) { |
| 4282 | arg.replace(FN_ARG, function(all, underscore, name) { |
| 4283 | $inject.push(name); |
| 4284 | }); |
| 4285 | }); |
| 4286 | } |
| 4287 | fn.$inject = $inject; |
| 4288 | } |
| 4289 | } else if (isArray(fn)) { |
| 4290 | last = fn.length - 1; |
| 4291 | assertArgFn(fn[last], 'fn'); |
| 4292 | $inject = fn.slice(0, last); |
| 4293 | } else { |
| 4294 | assertArgFn(fn, 'fn', true); |
| 4295 | } |
| 4296 | return $inject; |
| 4297 | } |
| 4298 | |
| 4299 | /////////////////////////////////////// |
| 4300 |
nothing calls this directly
no test coverage detected