| 5021 | //////////////////////////////////// |
| 5022 | |
| 5023 | function createInternalInjector(cache, factory) { |
| 5024 | |
| 5025 | function getService(serviceName, caller) { |
| 5026 | if (cache.hasOwnProperty(serviceName)) { |
| 5027 | if (cache[serviceName] === INSTANTIATING) { |
| 5028 | throw $injectorMinErr('cdep', 'Circular dependency found: {0}', |
| 5029 | serviceName + ' <- ' + path.join(' <- ')); |
| 5030 | } |
| 5031 | return cache[serviceName]; |
| 5032 | } else { |
| 5033 | try { |
| 5034 | path.unshift(serviceName); |
| 5035 | cache[serviceName] = INSTANTIATING; |
| 5036 | cache[serviceName] = factory(serviceName, caller); |
| 5037 | return cache[serviceName]; |
| 5038 | } catch (err) { |
| 5039 | if (cache[serviceName] === INSTANTIATING) { |
| 5040 | delete cache[serviceName]; |
| 5041 | } |
| 5042 | throw err; |
| 5043 | } finally { |
| 5044 | path.shift(); |
| 5045 | } |
| 5046 | } |
| 5047 | } |
| 5048 | |
| 5049 | |
| 5050 | function injectionArgs(fn, locals, serviceName) { |
| 5051 | var args = [], |
| 5052 | $inject = createInjector.$$annotate(fn, strictDi, serviceName); |
| 5053 | |
| 5054 | for (var i = 0, length = $inject.length; i < length; i++) { |
| 5055 | var key = $inject[i]; |
| 5056 | if (typeof key !== 'string') { |
| 5057 | throw $injectorMinErr('itkn', |
| 5058 | 'Incorrect injection token! Expected service name as string, got {0}', key); |
| 5059 | } |
| 5060 | args.push(locals && locals.hasOwnProperty(key) ? locals[key] : |
| 5061 | getService(key, serviceName)); |
| 5062 | } |
| 5063 | return args; |
| 5064 | } |
| 5065 | |
| 5066 | function isClass(func) { |
| 5067 | // Support: IE 9-11 only |
| 5068 | // IE 9-11 do not support classes and IE9 leaks with the code below. |
| 5069 | if (msie || typeof func !== 'function') { |
| 5070 | return false; |
| 5071 | } |
| 5072 | var result = func.$$ngIsClass; |
| 5073 | if (!isBoolean(result)) { |
| 5074 | result = func.$$ngIsClass = /^class\b/.test(stringifyFn(func)); |
| 5075 | } |
| 5076 | return result; |
| 5077 | } |
| 5078 | |
| 5079 | function invoke(fn, self, locals, serviceName) { |
| 5080 | if (typeof locals === 'string') { |