| 4396 | function createInternalInjector(cache, factory) { |
| 4397 | |
| 4398 | function getService(serviceName, caller) { |
| 4399 | if (cache.hasOwnProperty(serviceName)) { |
| 4400 | if (cache[serviceName] === INSTANTIATING) { |
| 4401 | throw $injectorMinErr('cdep', 'Circular dependency found: {0}', |
| 4402 | serviceName + ' <- ' + path.join(' <- ')); |
| 4403 | } |
| 4404 | return cache[serviceName]; |
| 4405 | } else { |
| 4406 | try { |
| 4407 | path.unshift(serviceName); |
| 4408 | cache[serviceName] = INSTANTIATING; |
| 4409 | return cache[serviceName] = factory(serviceName, caller); |
| 4410 | } catch (err) { |
| 4411 | if (cache[serviceName] === INSTANTIATING) { |
| 4412 | delete cache[serviceName]; |
| 4413 | } |
| 4414 | throw err; |
| 4415 | } finally { |
| 4416 | path.shift(); |
| 4417 | } |
| 4418 | } |
| 4419 | } |
| 4420 | |
| 4421 | function invoke(fn, self, locals, serviceName) { |
| 4422 | if (typeof locals === 'string') { |