| 4165 | function createInternalInjector(cache, factory) { |
| 4166 | |
| 4167 | function getService(serviceName, caller) { |
| 4168 | if (cache.hasOwnProperty(serviceName)) { |
| 4169 | if (cache[serviceName] === INSTANTIATING) { |
| 4170 | throw $injectorMinErr('cdep', 'Circular dependency found: {0}', |
| 4171 | serviceName + ' <- ' + path.join(' <- ')); |
| 4172 | } |
| 4173 | return cache[serviceName]; |
| 4174 | } else { |
| 4175 | try { |
| 4176 | path.unshift(serviceName); |
| 4177 | cache[serviceName] = INSTANTIATING; |
| 4178 | return cache[serviceName] = factory(serviceName, caller); |
| 4179 | } catch (err) { |
| 4180 | if (cache[serviceName] === INSTANTIATING) { |
| 4181 | delete cache[serviceName]; |
| 4182 | } |
| 4183 | throw err; |
| 4184 | } finally { |
| 4185 | path.shift(); |
| 4186 | } |
| 4187 | } |
| 4188 | } |
| 4189 | |
| 4190 | function invoke(fn, self, locals, serviceName) { |
| 4191 | if (typeof locals === 'string') { |