(fn, strictDi, name)
| 4453 | } |
| 4454 | |
| 4455 | function annotate(fn, strictDi, name) { |
| 4456 | var $inject, |
| 4457 | argDecl, |
| 4458 | last; |
| 4459 | |
| 4460 | if (typeof fn === 'function') { |
| 4461 | if (!($inject = fn.$inject)) { |
| 4462 | $inject = []; |
| 4463 | if (fn.length) { |
| 4464 | if (strictDi) { |
| 4465 | if (!isString(name) || !name) { |
| 4466 | name = fn.name || anonFn(fn); |
| 4467 | } |
| 4468 | throw $injectorMinErr('strictdi', |
| 4469 | '{0} is not using explicit annotation and cannot be invoked in strict mode', name); |
| 4470 | } |
| 4471 | argDecl = extractArgs(fn); |
| 4472 | forEach(argDecl[1].split(FN_ARG_SPLIT), function (arg) { |
| 4473 | arg.replace(FN_ARG, function (all, underscore, name) { |
| 4474 | $inject.push(name); |
| 4475 | }); |
| 4476 | }); |
| 4477 | } |
| 4478 | fn.$inject = $inject; |
| 4479 | } |
| 4480 | } else if (isArray(fn)) { |
| 4481 | last = fn.length - 1; |
| 4482 | assertArgFn(fn[last], 'fn'); |
| 4483 | $inject = fn.slice(0, last); |
| 4484 | } else { |
| 4485 | assertArgFn(fn, 'fn', true); |
| 4486 | } |
| 4487 | return $inject; |
| 4488 | } |
| 4489 | |
| 4490 | /////////////////////////////////////// |
| 4491 |
nothing calls this directly
no test coverage detected