(fn, self, locals, serviceName)
| 5127 | } |
| 5128 | |
| 5129 | function invoke(fn, self, locals, serviceName) { |
| 5130 | if (typeof locals === 'string') { |
| 5131 | serviceName = locals; |
| 5132 | locals = null; |
| 5133 | } |
| 5134 | |
| 5135 | var args = injectionArgs(fn, locals, serviceName); |
| 5136 | if (isArray(fn)) { |
| 5137 | fn = fn[fn.length - 1]; |
| 5138 | } |
| 5139 | |
| 5140 | if (!isClass(fn)) { |
| 5141 | // http://jsperf.com/angularjs-invoke-apply-vs-switch |
| 5142 | // #5388 |
| 5143 | return fn.apply(self, args); |
| 5144 | } else { |
| 5145 | args.unshift(null); |
| 5146 | return new (Function.prototype.bind.apply(fn, args))(); |
| 5147 | } |
| 5148 | } |
| 5149 | |
| 5150 | |
| 5151 | function instantiate(Type, locals, serviceName) { |
nothing calls this directly
no test coverage detected