(fn, self, locals, serviceName)
| 4602 | } |
| 4603 | |
| 4604 | function invoke(fn, self, locals, serviceName) { |
| 4605 | if (typeof locals === 'string') { |
| 4606 | serviceName = locals; |
| 4607 | locals = null; |
| 4608 | } |
| 4609 | |
| 4610 | var args = injectionArgs(fn, locals, serviceName); |
| 4611 | if (isArray(fn)) { |
| 4612 | fn = fn[fn.length - 1]; |
| 4613 | } |
| 4614 | |
| 4615 | if (!isClass(fn)) { |
| 4616 | // http://jsperf.com/angularjs-invoke-apply-vs-switch |
| 4617 | // #5388 |
| 4618 | return fn.apply(self, args); |
| 4619 | } else { |
| 4620 | args.unshift(null); |
| 4621 | return new (Function.prototype.bind.apply(fn, args))(); |
| 4622 | } |
| 4623 | } |
| 4624 | |
| 4625 | function instantiate(Type, locals, serviceName) { |
| 4626 | // Check if Type is annotated and use just the given function at n-1 as parameter |
nothing calls this directly
no test coverage detected