(Type, locals, serviceName)
| 5123 | |
| 5124 | |
| 5125 | function instantiate(Type, locals, serviceName) { |
| 5126 | // Check if Type is annotated and use just the given function at n-1 as parameter |
| 5127 | // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); |
| 5128 | var ctor = (isArray(Type) ? Type[Type.length - 1] : Type); |
| 5129 | var args = injectionArgs(Type, locals, serviceName); |
| 5130 | // Empty object at position 0 is ignored for invocation with `new`, but required. |
| 5131 | args.unshift(null); |
| 5132 | return new (Function.prototype.bind.apply(ctor, args))(); |
| 5133 | } |
| 5134 | |
| 5135 | |
| 5136 | return { |
no test coverage detected