(fn, self, locals)
| 3941 | } |
| 3942 | |
| 3943 | function invoke(fn, self, locals){ |
| 3944 | var args = [], |
| 3945 | $inject = annotate(fn), |
| 3946 | length, i, |
| 3947 | key; |
| 3948 | |
| 3949 | for(i = 0, length = $inject.length; i < length; i++) { |
| 3950 | key = $inject[i]; |
| 3951 | if (typeof key !== 'string') { |
| 3952 | throw $injectorMinErr('itkn', |
| 3953 | 'Incorrect injection token! Expected service name as string, got {0}', key); |
| 3954 | } |
| 3955 | args.push( |
| 3956 | locals && locals.hasOwnProperty(key) |
| 3957 | ? locals[key] |
| 3958 | : getService(key) |
| 3959 | ); |
| 3960 | } |
| 3961 | if (isArray(fn)) { |
| 3962 | fn = fn[length]; |
| 3963 | } |
| 3964 | |
| 3965 | // http://jsperf.com/angularjs-invoke-apply-vs-switch |
| 3966 | // #5388 |
| 3967 | return fn.apply(self, args); |
| 3968 | } |
| 3969 | |
| 3970 | function instantiate(Type, locals) { |
| 3971 | var Constructor = function() {}, |
no test coverage detected