(fn, self, locals, serviceName)
| 5077 | } |
| 5078 | |
| 5079 | function invoke(fn, self, locals, serviceName) { |
| 5080 | if (typeof locals === 'string') { |
| 5081 | serviceName = locals; |
| 5082 | locals = null; |
| 5083 | } |
| 5084 | |
| 5085 | var args = injectionArgs(fn, locals, serviceName); |
| 5086 | if (isArray(fn)) { |
| 5087 | fn = fn[fn.length - 1]; |
| 5088 | } |
| 5089 | |
| 5090 | if (!isClass(fn)) { |
| 5091 | // http://jsperf.com/angularjs-invoke-apply-vs-switch |
| 5092 | // #5388 |
| 5093 | return fn.apply(self, args); |
| 5094 | } else { |
| 5095 | args.unshift(null); |
| 5096 | return new (Function.prototype.bind.apply(fn, args))(); |
| 5097 | } |
| 5098 | } |
| 5099 | |
| 5100 | |
| 5101 | function instantiate(Type, locals, serviceName) { |
nothing calls this directly
no test coverage detected