| 3917 | function createInternalInjector(cache, factory) { |
| 3918 | |
| 3919 | function getService(serviceName) { |
| 3920 | if (cache.hasOwnProperty(serviceName)) { |
| 3921 | if (cache[serviceName] === INSTANTIATING) { |
| 3922 | throw $injectorMinErr('cdep', 'Circular dependency found: {0}', |
| 3923 | serviceName + ' <- ' + path.join(' <- ')); |
| 3924 | } |
| 3925 | return cache[serviceName]; |
| 3926 | } else { |
| 3927 | try { |
| 3928 | path.unshift(serviceName); |
| 3929 | cache[serviceName] = INSTANTIATING; |
| 3930 | return cache[serviceName] = factory(serviceName); |
| 3931 | } catch (err) { |
| 3932 | if (cache[serviceName] === INSTANTIATING) { |
| 3933 | delete cache[serviceName]; |
| 3934 | } |
| 3935 | throw err; |
| 3936 | } finally { |
| 3937 | path.shift(); |
| 3938 | } |
| 3939 | } |
| 3940 | } |
| 3941 | |
| 3942 | function invoke(fn, self, locals){ |
| 3943 | var args = [], |