| 4516 | function createInternalInjector(cache, factory) { |
| 4517 | |
| 4518 | function getService(serviceName, caller) { |
| 4519 | if (cache.hasOwnProperty(serviceName)) { |
| 4520 | if (cache[serviceName] === INSTANTIATING) { |
| 4521 | throw $injectorMinErr('cdep', 'Circular dependency found: {0}', |
| 4522 | serviceName + ' <- ' + path.join(' <- ')); |
| 4523 | } |
| 4524 | return cache[serviceName]; |
| 4525 | } else { |
| 4526 | try { |
| 4527 | path.unshift(serviceName); |
| 4528 | cache[serviceName] = INSTANTIATING; |
| 4529 | return cache[serviceName] = factory(serviceName, caller); |
| 4530 | } catch (err) { |
| 4531 | if (cache[serviceName] === INSTANTIATING) { |
| 4532 | delete cache[serviceName]; |
| 4533 | } |
| 4534 | throw err; |
| 4535 | } finally { |
| 4536 | path.shift(); |
| 4537 | } |
| 4538 | } |
| 4539 | } |
| 4540 | |
| 4541 | function invoke(fn, self, locals, serviceName) { |
| 4542 | if (typeof locals === 'string') { |