(fn, self, locals, serviceName)
| 4755 | } |
| 4756 | |
| 4757 | function invoke(fn, self, locals, serviceName) { |
| 4758 | if (typeof locals === 'string') { |
| 4759 | serviceName = locals; |
| 4760 | locals = null; |
| 4761 | } |
| 4762 | |
| 4763 | var args = injectionArgs(fn, locals, serviceName); |
| 4764 | if (isArray(fn)) { |
| 4765 | fn = fn[fn.length - 1]; |
| 4766 | } |
| 4767 | |
| 4768 | if (!isClass(fn)) { |
| 4769 | // http://jsperf.com/angularjs-invoke-apply-vs-switch |
| 4770 | // #5388 |
| 4771 | return fn.apply(self, args); |
| 4772 | } else { |
| 4773 | args.unshift(null); |
| 4774 | return new (Function.prototype.bind.apply(fn, args))(); |
| 4775 | } |
| 4776 | } |
| 4777 | |
| 4778 | |
| 4779 | function instantiate(Type, locals, serviceName) { |
nothing calls this directly
no test coverage detected