| 3891 | function createInternalInjector(cache, factory) { |
| 3892 | |
| 3893 | function getService(serviceName) { |
| 3894 | if (cache.hasOwnProperty(serviceName)) { |
| 3895 | if (cache[serviceName] === INSTANTIATING) { |
| 3896 | throw $injectorMinErr('cdep', 'Circular dependency found: {0}', |
| 3897 | serviceName + ' <- ' + path.join(' <- ')); |
| 3898 | } |
| 3899 | return cache[serviceName]; |
| 3900 | } else { |
| 3901 | try { |
| 3902 | path.unshift(serviceName); |
| 3903 | cache[serviceName] = INSTANTIATING; |
| 3904 | return cache[serviceName] = factory(serviceName); |
| 3905 | } catch (err) { |
| 3906 | if (cache[serviceName] === INSTANTIATING) { |
| 3907 | delete cache[serviceName]; |
| 3908 | } |
| 3909 | throw err; |
| 3910 | } finally { |
| 3911 | path.shift(); |
| 3912 | } |
| 3913 | } |
| 3914 | } |
| 3915 | |
| 3916 | function invoke(fn, self, locals){ |
| 3917 | var args = [], |