(fn, self, locals, serviceName)
| 5101 | } |
| 5102 | |
| 5103 | function invoke(fn, self, locals, serviceName) { |
| 5104 | if (typeof locals === 'string') { |
| 5105 | serviceName = locals; |
| 5106 | locals = null; |
| 5107 | } |
| 5108 | |
| 5109 | var args = injectionArgs(fn, locals, serviceName); |
| 5110 | if (isArray(fn)) { |
| 5111 | fn = fn[fn.length - 1]; |
| 5112 | } |
| 5113 | |
| 5114 | if (!isClass(fn)) { |
| 5115 | // http://jsperf.com/angularjs-invoke-apply-vs-switch |
| 5116 | // #5388 |
| 5117 | return fn.apply(self, args); |
| 5118 | } else { |
| 5119 | args.unshift(null); |
| 5120 | return new (Function.prototype.bind.apply(fn, args))(); |
| 5121 | } |
| 5122 | } |
| 5123 | |
| 5124 | |
| 5125 | function instantiate(Type, locals, serviceName) { |
nothing calls this directly
no test coverage detected