(fn, strictDi, name)
| 4290 | } |
| 4291 | |
| 4292 | function annotate(fn, strictDi, name) { |
| 4293 | var $inject, |
| 4294 | argDecl, |
| 4295 | last; |
| 4296 | |
| 4297 | if (typeof fn === 'function') { |
| 4298 | if (!($inject = fn.$inject)) { |
| 4299 | $inject = []; |
| 4300 | if (fn.length) { |
| 4301 | if (strictDi) { |
| 4302 | if (!isString(name) || !name) { |
| 4303 | name = fn.name || anonFn(fn); |
| 4304 | } |
| 4305 | throw $injectorMinErr('strictdi', |
| 4306 | '{0} is not using explicit annotation and cannot be invoked in strict mode', name); |
| 4307 | } |
| 4308 | argDecl = extractArgs(fn); |
| 4309 | forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) { |
| 4310 | arg.replace(FN_ARG, function(all, underscore, name) { |
| 4311 | $inject.push(name); |
| 4312 | }); |
| 4313 | }); |
| 4314 | } |
| 4315 | fn.$inject = $inject; |
| 4316 | } |
| 4317 | } else if (isArray(fn)) { |
| 4318 | last = fn.length - 1; |
| 4319 | assertArgFn(fn[last], 'fn'); |
| 4320 | $inject = fn.slice(0, last); |
| 4321 | } else { |
| 4322 | assertArgFn(fn, 'fn', true); |
| 4323 | } |
| 4324 | return $inject; |
| 4325 | } |
| 4326 | |
| 4327 | /////////////////////////////////////// |
| 4328 |
nothing calls this directly
no test coverage detected