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