001    /*
002     * Copyright 2010-2014 JetBrains s.r.o.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.jetbrains.jet.di;
018    
019    import com.intellij.openapi.project.Project;
020    import org.jetbrains.jet.context.GlobalContextImpl;
021    import org.jetbrains.jet.storage.LockBasedStorageManager;
022    import org.jetbrains.jet.lang.descriptors.ModuleDescriptorImpl;
023    import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
024    import org.jetbrains.jet.lang.resolve.lazy.declarations.DeclarationProviderFactory;
025    import org.jetbrains.jet.lang.resolve.BindingTrace;
026    import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
027    import org.jetbrains.jet.lang.resolve.AnnotationResolver;
028    import org.jetbrains.jet.lang.resolve.calls.CallResolver;
029    import org.jetbrains.jet.lang.resolve.calls.ArgumentTypeResolver;
030    import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices;
031    import org.jetbrains.jet.lang.types.expressions.ExpressionTypingComponents;
032    import org.jetbrains.jet.lang.types.expressions.ControlStructureTypingUtils;
033    import org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils;
034    import org.jetbrains.jet.lang.types.expressions.ForLoopConventionsChecker;
035    import org.jetbrains.jet.lang.reflect.ReflectionTypes;
036    import org.jetbrains.jet.lang.resolve.calls.CallExpressionResolver;
037    import org.jetbrains.jet.lang.resolve.DescriptorResolver;
038    import org.jetbrains.jet.lang.resolve.DelegatedPropertyResolver;
039    import org.jetbrains.jet.lang.resolve.TypeResolver;
040    import org.jetbrains.jet.lang.resolve.QualifiedExpressionResolver;
041    import org.jetbrains.jet.lang.resolve.calls.CallResolverExtensionProvider;
042    import org.jetbrains.jet.lang.resolve.calls.CandidateResolver;
043    import org.jetbrains.jet.lang.psi.JetImportsFactory;
044    import org.jetbrains.jet.lang.resolve.lazy.ScopeProvider;
045    import org.jetbrains.jet.lang.resolve.ScriptBodyResolver;
046    import org.jetbrains.annotations.NotNull;
047    import javax.annotation.PreDestroy;
048    
049    /* This file is generated by org.jetbrains.jet.generators.injectors.InjectorsPackage. DO NOT EDIT! */
050    @SuppressWarnings("ALL")
051    public class InjectorForLazyResolve {
052        
053        private final Project project;
054        private final GlobalContextImpl globalContext;
055        private final LockBasedStorageManager lockBasedStorageManager;
056        private final ModuleDescriptorImpl moduleDescriptor;
057        private final PlatformToKotlinClassMap platformToKotlinClassMap;
058        private final DeclarationProviderFactory declarationProviderFactory;
059        private final BindingTrace bindingTrace;
060        private final ResolveSession resolveSession;
061        private final AnnotationResolver annotationResolver;
062        private final CallResolver callResolver;
063        private final ArgumentTypeResolver argumentTypeResolver;
064        private final ExpressionTypingServices expressionTypingServices;
065        private final ExpressionTypingComponents expressionTypingComponents;
066        private final ControlStructureTypingUtils controlStructureTypingUtils;
067        private final ExpressionTypingUtils expressionTypingUtils;
068        private final ForLoopConventionsChecker forLoopConventionsChecker;
069        private final ReflectionTypes reflectionTypes;
070        private final CallExpressionResolver callExpressionResolver;
071        private final DescriptorResolver descriptorResolver;
072        private final DelegatedPropertyResolver delegatedPropertyResolver;
073        private final TypeResolver typeResolver;
074        private final QualifiedExpressionResolver qualifiedExpressionResolver;
075        private final CallResolverExtensionProvider callResolverExtensionProvider;
076        private final CandidateResolver candidateResolver;
077        private final JetImportsFactory jetImportsFactory;
078        private final ScopeProvider scopeProvider;
079        private final ScriptBodyResolver scriptBodyResolver;
080        
081        public InjectorForLazyResolve(
082            @NotNull Project project,
083            @NotNull GlobalContextImpl globalContext,
084            @NotNull ModuleDescriptorImpl moduleDescriptor,
085            @NotNull DeclarationProviderFactory declarationProviderFactory,
086            @NotNull BindingTrace bindingTrace
087        ) {
088            this.project = project;
089            this.globalContext = globalContext;
090            this.lockBasedStorageManager = globalContext.getStorageManager();
091            this.moduleDescriptor = moduleDescriptor;
092            this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
093            this.declarationProviderFactory = declarationProviderFactory;
094            this.bindingTrace = bindingTrace;
095            this.resolveSession = new ResolveSession(project, globalContext, moduleDescriptor, declarationProviderFactory, bindingTrace);
096            this.annotationResolver = new AnnotationResolver();
097            this.callResolver = new CallResolver();
098            this.argumentTypeResolver = new ArgumentTypeResolver();
099            this.expressionTypingComponents = new ExpressionTypingComponents();
100            this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents);
101            this.controlStructureTypingUtils = new ControlStructureTypingUtils(expressionTypingServices);
102            this.expressionTypingUtils = new ExpressionTypingUtils(expressionTypingServices, callResolver);
103            this.forLoopConventionsChecker = new ForLoopConventionsChecker();
104            this.reflectionTypes = new ReflectionTypes(moduleDescriptor);
105            this.callExpressionResolver = new CallExpressionResolver();
106            this.descriptorResolver = new DescriptorResolver();
107            this.delegatedPropertyResolver = new DelegatedPropertyResolver();
108            this.typeResolver = new TypeResolver();
109            this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
110            this.callResolverExtensionProvider = new CallResolverExtensionProvider();
111            this.candidateResolver = new CandidateResolver();
112            this.jetImportsFactory = new JetImportsFactory();
113            this.scopeProvider = new ScopeProvider(getResolveSession());
114            this.scriptBodyResolver = new ScriptBodyResolver();
115    
116            this.resolveSession.setAnnotationResolve(annotationResolver);
117            this.resolveSession.setDescriptorResolver(descriptorResolver);
118            this.resolveSession.setJetImportFactory(jetImportsFactory);
119            this.resolveSession.setQualifiedExpressionResolver(qualifiedExpressionResolver);
120            this.resolveSession.setScopeProvider(scopeProvider);
121            this.resolveSession.setScriptBodyResolver(scriptBodyResolver);
122            this.resolveSession.setTypeResolver(typeResolver);
123    
124            annotationResolver.setCallResolver(callResolver);
125            annotationResolver.setStorageManager(lockBasedStorageManager);
126            annotationResolver.setTypeResolver(typeResolver);
127    
128            callResolver.setArgumentTypeResolver(argumentTypeResolver);
129            callResolver.setCandidateResolver(candidateResolver);
130            callResolver.setExpressionTypingServices(expressionTypingServices);
131            callResolver.setTypeResolver(typeResolver);
132    
133            argumentTypeResolver.setExpressionTypingServices(expressionTypingServices);
134            argumentTypeResolver.setTypeResolver(typeResolver);
135    
136            expressionTypingServices.setAnnotationResolver(annotationResolver);
137            expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
138            expressionTypingServices.setCallResolver(callResolver);
139            expressionTypingServices.setDescriptorResolver(descriptorResolver);
140            expressionTypingServices.setExtensionProvider(callResolverExtensionProvider);
141            expressionTypingServices.setProject(project);
142            expressionTypingServices.setTypeResolver(typeResolver);
143    
144            expressionTypingComponents.setCallResolver(callResolver);
145            expressionTypingComponents.setControlStructureTypingUtils(controlStructureTypingUtils);
146            expressionTypingComponents.setExpressionTypingServices(expressionTypingServices);
147            expressionTypingComponents.setExpressionTypingUtils(expressionTypingUtils);
148            expressionTypingComponents.setForLoopConventionsChecker(forLoopConventionsChecker);
149            expressionTypingComponents.setGlobalContext(globalContext);
150            expressionTypingComponents.setPlatformToKotlinClassMap(platformToKotlinClassMap);
151            expressionTypingComponents.setReflectionTypes(reflectionTypes);
152    
153            forLoopConventionsChecker.setExpressionTypingServices(expressionTypingServices);
154            forLoopConventionsChecker.setExpressionTypingUtils(expressionTypingUtils);
155            forLoopConventionsChecker.setProject(project);
156    
157            callExpressionResolver.setExpressionTypingServices(expressionTypingServices);
158    
159            descriptorResolver.setAnnotationResolver(annotationResolver);
160            descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
161            descriptorResolver.setExpressionTypingServices(expressionTypingServices);
162            descriptorResolver.setStorageManager(lockBasedStorageManager);
163            descriptorResolver.setTypeResolver(typeResolver);
164    
165            delegatedPropertyResolver.setCallResolver(callResolver);
166            delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);
167    
168            typeResolver.setAnnotationResolver(annotationResolver);
169            typeResolver.setModuleDescriptor(moduleDescriptor);
170            typeResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);
171    
172            candidateResolver.setArgumentTypeResolver(argumentTypeResolver);
173    
174            jetImportsFactory.setProject(project);
175    
176            scriptBodyResolver.setExpressionTypingServices(expressionTypingServices);
177    
178        }
179        
180        @PreDestroy
181        public void destroy() {
182        }
183        
184        public ResolveSession getResolveSession() {
185            return this.resolveSession;
186        }
187        
188    }