| 5071 | //////////////////////////////////// |
| 5072 | |
| 5073 | function createInternalInjector(cache, factory) { |
| 5074 | |
| 5075 | function getService(serviceName, caller) { |
| 5076 | if (cache.hasOwnProperty(serviceName)) { |
| 5077 | if (cache[serviceName] === INSTANTIATING) { |
| 5078 | throw $injectorMinErr('cdep', 'Circular dependency found: {0}', |
| 5079 | serviceName + ' <- ' + path.join(' <- ')); |
| 5080 | } |
| 5081 | return cache[serviceName]; |
| 5082 | } else { |
| 5083 | try { |
| 5084 | path.unshift(serviceName); |
| 5085 | cache[serviceName] = INSTANTIATING; |
| 5086 | cache[serviceName] = factory(serviceName, caller); |
| 5087 | return cache[serviceName]; |
| 5088 | } catch (err) { |
| 5089 | if (cache[serviceName] === INSTANTIATING) { |
| 5090 | delete cache[serviceName]; |
| 5091 | } |
| 5092 | throw err; |
| 5093 | } finally { |
| 5094 | path.shift(); |
| 5095 | } |
| 5096 | } |
| 5097 | } |
| 5098 | |
| 5099 | |
| 5100 | function injectionArgs(fn, locals, serviceName) { |
| 5101 | var args = [], |
| 5102 | $inject = createInjector.$$annotate(fn, strictDi, serviceName); |
| 5103 | |
| 5104 | for (var i = 0, length = $inject.length; i < length; i++) { |
| 5105 | var key = $inject[i]; |
| 5106 | if (typeof key !== 'string') { |
| 5107 | throw $injectorMinErr('itkn', |
| 5108 | 'Incorrect injection token! Expected service name as string, got {0}', key); |
| 5109 | } |
| 5110 | args.push(locals && locals.hasOwnProperty(key) ? locals[key] : |
| 5111 | getService(key, serviceName)); |
| 5112 | } |
| 5113 | return args; |
| 5114 | } |
| 5115 | |
| 5116 | function isClass(func) { |
| 5117 | // Support: IE 9-11 only |
| 5118 | // IE 9-11 do not support classes and IE9 leaks with the code below. |
| 5119 | if (msie || typeof func !== 'function') { |
| 5120 | return false; |
| 5121 | } |
| 5122 | var result = func.$$ngIsClass; |
| 5123 | if (!isBoolean(result)) { |
| 5124 | result = func.$$ngIsClass = /^class\b/.test(stringifyFn(func)); |
| 5125 | } |
| 5126 | return result; |
| 5127 | } |
| 5128 | |
| 5129 | function invoke(fn, self, locals, serviceName) { |
| 5130 | if (typeof locals === 'string') { |