(fn, strictDi, name)
| 4355 | } |
| 4356 | |
| 4357 | function annotate(fn, strictDi, name) { |
| 4358 | var $inject, |
| 4359 | argDecl, |
| 4360 | last; |
| 4361 | |
| 4362 | if (typeof fn === 'function') { |
| 4363 | if (!($inject = fn.$inject)) { |
| 4364 | $inject = []; |
| 4365 | if (fn.length) { |
| 4366 | if (strictDi) { |
| 4367 | if (!isString(name) || !name) { |
| 4368 | name = fn.name || anonFn(fn); |
| 4369 | } |
| 4370 | throw $injectorMinErr('strictdi', |
| 4371 | '{0} is not using explicit annotation and cannot be invoked in strict mode', name); |
| 4372 | } |
| 4373 | argDecl = extractArgs(fn); |
| 4374 | forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) { |
| 4375 | arg.replace(FN_ARG, function(all, underscore, name) { |
| 4376 | $inject.push(name); |
| 4377 | }); |
| 4378 | }); |
| 4379 | } |
| 4380 | fn.$inject = $inject; |
| 4381 | } |
| 4382 | } else if (isArray(fn)) { |
| 4383 | last = fn.length - 1; |
| 4384 | assertArgFn(fn[last], 'fn'); |
| 4385 | $inject = fn.slice(0, last); |
| 4386 | } else { |
| 4387 | assertArgFn(fn, 'fn', true); |
| 4388 | } |
| 4389 | return $inject; |
| 4390 | } |
| 4391 | |
| 4392 | /////////////////////////////////////// |
| 4393 |
nothing calls this directly
no test coverage detected