(fn, self, locals, serviceName)
| 4588 | } |
| 4589 | |
| 4590 | function invoke(fn, self, locals, serviceName) { |
| 4591 | if (typeof locals === 'string') { |
| 4592 | serviceName = locals; |
| 4593 | locals = null; |
| 4594 | } |
| 4595 | |
| 4596 | var args = injectionArgs(fn, locals, serviceName); |
| 4597 | if (isArray(fn)) { |
| 4598 | fn = fn[fn.length - 1]; |
| 4599 | } |
| 4600 | |
| 4601 | if (!isClass(fn)) { |
| 4602 | // http://jsperf.com/angularjs-invoke-apply-vs-switch |
| 4603 | // #5388 |
| 4604 | return fn.apply(self, args); |
| 4605 | } else { |
| 4606 | args.unshift(null); |
| 4607 | return new (Function.prototype.bind.apply(fn, args))(); |
| 4608 | } |
| 4609 | } |
| 4610 | |
| 4611 | |
| 4612 | function instantiate(Type, locals, serviceName) { |
nothing calls this directly
no test coverage detected