(Type, locals, serviceName)
| 4170 | } |
| 4171 | |
| 4172 | function instantiate(Type, locals, serviceName) { |
| 4173 | // Check if Type is annotated and use just the given function at n-1 as parameter |
| 4174 | // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); |
| 4175 | // Object creation: http://jsperf.com/create-constructor/2 |
| 4176 | var instance = Object.create((isArray(Type) ? Type[Type.length - 1] : Type).prototype); |
| 4177 | var returnedValue = invoke(Type, instance, locals, serviceName); |
| 4178 | |
| 4179 | return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance; |
| 4180 | } |
| 4181 | |
| 4182 | return { |
| 4183 | invoke: invoke, |
nothing calls this directly
no test coverage detected