| 4115 | function createInternalInjector(cache, factory) { |
| 4116 | |
| 4117 | function getService(serviceName, caller) { |
| 4118 | if (cache.hasOwnProperty(serviceName)) { |
| 4119 | if (cache[serviceName] === INSTANTIATING) { |
| 4120 | throw $injectorMinErr('cdep', 'Circular dependency found: {0}', |
| 4121 | serviceName + ' <- ' + path.join(' <- ')); |
| 4122 | } |
| 4123 | return cache[serviceName]; |
| 4124 | } else { |
| 4125 | try { |
| 4126 | path.unshift(serviceName); |
| 4127 | cache[serviceName] = INSTANTIATING; |
| 4128 | return cache[serviceName] = factory(serviceName, caller); |
| 4129 | } catch (err) { |
| 4130 | if (cache[serviceName] === INSTANTIATING) { |
| 4131 | delete cache[serviceName]; |
| 4132 | } |
| 4133 | throw err; |
| 4134 | } finally { |
| 4135 | path.shift(); |
| 4136 | } |
| 4137 | } |
| 4138 | } |
| 4139 | |
| 4140 | function invoke(fn, self, locals, serviceName) { |
| 4141 | if (typeof locals === 'string') { |