| 4424 | function createInternalInjector(cache, factory) { |
| 4425 | |
| 4426 | function getService(serviceName, caller) { |
| 4427 | if (cache.hasOwnProperty(serviceName)) { |
| 4428 | if (cache[serviceName] === INSTANTIATING) { |
| 4429 | throw $injectorMinErr('cdep', 'Circular dependency found: {0}', |
| 4430 | serviceName + ' <- ' + path.join(' <- ')); |
| 4431 | } |
| 4432 | return cache[serviceName]; |
| 4433 | } else { |
| 4434 | try { |
| 4435 | path.unshift(serviceName); |
| 4436 | cache[serviceName] = INSTANTIATING; |
| 4437 | return cache[serviceName] = factory(serviceName, caller); |
| 4438 | } catch (err) { |
| 4439 | if (cache[serviceName] === INSTANTIATING) { |
| 4440 | delete cache[serviceName]; |
| 4441 | } |
| 4442 | throw err; |
| 4443 | } finally { |
| 4444 | path.shift(); |
| 4445 | } |
| 4446 | } |
| 4447 | } |
| 4448 | |
| 4449 | function invoke(fn, self, locals, serviceName) { |
| 4450 | if (typeof locals === 'string') { |