(fn, self, locals, serviceName)
| 5192 | } |
| 5193 | |
| 5194 | function invoke(fn, self, locals, serviceName) { |
| 5195 | if (typeof locals === 'string') { |
| 5196 | serviceName = locals; |
| 5197 | locals = null; |
| 5198 | } |
| 5199 | |
| 5200 | var args = injectionArgs(fn, locals, serviceName); |
| 5201 | if (isArray(fn)) { |
| 5202 | fn = fn[fn.length - 1]; |
| 5203 | } |
| 5204 | |
| 5205 | if (!isClass(fn)) { |
| 5206 | // http://jsperf.com/angularjs-invoke-apply-vs-switch |
| 5207 | // #5388 |
| 5208 | return fn.apply(self, args); |
| 5209 | } else { |
| 5210 | args.unshift(null); |
| 5211 | return new (Function.prototype.bind.apply(fn, args))(); |
| 5212 | } |
| 5213 | } |
| 5214 | |
| 5215 | |
| 5216 | function instantiate(Type, locals, serviceName) { |
nothing calls this directly
no test coverage detected