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