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.lang.descriptors.ModuleDescriptor;
021    import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
022    import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices;
023    import org.jetbrains.jet.lang.types.expressions.ExpressionTypingComponents;
024    import org.jetbrains.jet.lang.resolve.calls.CallResolver;
025    import org.jetbrains.jet.context.GlobalContext;
026    import org.jetbrains.jet.storage.StorageManager;
027    import org.jetbrains.jet.lang.resolve.AnnotationResolver;
028    import org.jetbrains.jet.lang.resolve.TypeResolver;
029    import org.jetbrains.jet.lang.resolve.QualifiedExpressionResolver;
030    import org.jetbrains.jet.lang.resolve.calls.CallExpressionResolver;
031    import org.jetbrains.jet.lang.resolve.DescriptorResolver;
032    import org.jetbrains.jet.lang.resolve.DelegatedPropertyResolver;
033    import org.jetbrains.jet.lang.resolve.calls.CallResolverExtensionProvider;
034    import org.jetbrains.jet.lang.types.expressions.ControlStructureTypingUtils;
035    import org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils;
036    import org.jetbrains.jet.lang.types.expressions.ForLoopConventionsChecker;
037    import org.jetbrains.jet.lang.reflect.ReflectionTypes;
038    import org.jetbrains.jet.lang.resolve.calls.ArgumentTypeResolver;
039    import org.jetbrains.jet.lang.resolve.calls.CandidateResolver;
040    import org.jetbrains.annotations.NotNull;
041    import javax.annotation.PreDestroy;
042    
043    /* This file is generated by org.jetbrains.jet.generators.injectors.InjectorsPackage. DO NOT EDIT! */
044    @SuppressWarnings("ALL")
045    public class InjectorForMacros {
046        
047        private final Project project;
048        private final ModuleDescriptor moduleDescriptor;
049        private final PlatformToKotlinClassMap platformToKotlinClassMap;
050        private final ExpressionTypingServices expressionTypingServices;
051        private final ExpressionTypingComponents expressionTypingComponents;
052        private final CallResolver callResolver;
053        private final GlobalContext globalContext;
054        private final StorageManager storageManager;
055        private final AnnotationResolver annotationResolver;
056        private final TypeResolver typeResolver;
057        private final QualifiedExpressionResolver qualifiedExpressionResolver;
058        private final CallExpressionResolver callExpressionResolver;
059        private final DescriptorResolver descriptorResolver;
060        private final DelegatedPropertyResolver delegatedPropertyResolver;
061        private final CallResolverExtensionProvider callResolverExtensionProvider;
062        private final ControlStructureTypingUtils controlStructureTypingUtils;
063        private final ExpressionTypingUtils expressionTypingUtils;
064        private final ForLoopConventionsChecker forLoopConventionsChecker;
065        private final ReflectionTypes reflectionTypes;
066        private final ArgumentTypeResolver argumentTypeResolver;
067        private final CandidateResolver candidateResolver;
068        
069        public InjectorForMacros(
070            @NotNull Project project,
071            @NotNull ModuleDescriptor moduleDescriptor
072        ) {
073            this.project = project;
074            this.moduleDescriptor = moduleDescriptor;
075            this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
076            this.expressionTypingComponents = new ExpressionTypingComponents();
077            this.expressionTypingServices = new ExpressionTypingServices(getExpressionTypingComponents());
078            this.callResolver = new CallResolver();
079            this.globalContext = org.jetbrains.jet.context.ContextPackage.GlobalContext();
080            this.storageManager = globalContext.getStorageManager();
081            this.annotationResolver = new AnnotationResolver();
082            this.typeResolver = new TypeResolver();
083            this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
084            this.callExpressionResolver = new CallExpressionResolver();
085            this.descriptorResolver = new DescriptorResolver();
086            this.delegatedPropertyResolver = new DelegatedPropertyResolver();
087            this.callResolverExtensionProvider = new CallResolverExtensionProvider();
088            this.controlStructureTypingUtils = new ControlStructureTypingUtils(getExpressionTypingServices());
089            this.expressionTypingUtils = new ExpressionTypingUtils(getExpressionTypingServices(), getCallResolver());
090            this.forLoopConventionsChecker = new ForLoopConventionsChecker();
091            this.reflectionTypes = new ReflectionTypes(moduleDescriptor);
092            this.argumentTypeResolver = new ArgumentTypeResolver();
093            this.candidateResolver = new CandidateResolver();
094    
095            this.expressionTypingServices.setAnnotationResolver(annotationResolver);
096            this.expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
097            this.expressionTypingServices.setCallResolver(callResolver);
098            this.expressionTypingServices.setDescriptorResolver(descriptorResolver);
099            this.expressionTypingServices.setExtensionProvider(callResolverExtensionProvider);
100            this.expressionTypingServices.setProject(project);
101            this.expressionTypingServices.setTypeResolver(typeResolver);
102    
103            this.expressionTypingComponents.setCallResolver(callResolver);
104            this.expressionTypingComponents.setControlStructureTypingUtils(controlStructureTypingUtils);
105            this.expressionTypingComponents.setExpressionTypingServices(expressionTypingServices);
106            this.expressionTypingComponents.setExpressionTypingUtils(expressionTypingUtils);
107            this.expressionTypingComponents.setForLoopConventionsChecker(forLoopConventionsChecker);
108            this.expressionTypingComponents.setGlobalContext(globalContext);
109            this.expressionTypingComponents.setPlatformToKotlinClassMap(platformToKotlinClassMap);
110            this.expressionTypingComponents.setReflectionTypes(reflectionTypes);
111    
112            this.callResolver.setArgumentTypeResolver(argumentTypeResolver);
113            this.callResolver.setCandidateResolver(candidateResolver);
114            this.callResolver.setExpressionTypingServices(expressionTypingServices);
115            this.callResolver.setTypeResolver(typeResolver);
116    
117            annotationResolver.setCallResolver(callResolver);
118            annotationResolver.setStorageManager(storageManager);
119            annotationResolver.setTypeResolver(typeResolver);
120    
121            typeResolver.setAnnotationResolver(annotationResolver);
122            typeResolver.setModuleDescriptor(moduleDescriptor);
123            typeResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);
124    
125            callExpressionResolver.setExpressionTypingServices(expressionTypingServices);
126    
127            descriptorResolver.setAnnotationResolver(annotationResolver);
128            descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
129            descriptorResolver.setExpressionTypingServices(expressionTypingServices);
130            descriptorResolver.setStorageManager(storageManager);
131            descriptorResolver.setTypeResolver(typeResolver);
132    
133            delegatedPropertyResolver.setCallResolver(callResolver);
134            delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);
135    
136            forLoopConventionsChecker.setExpressionTypingServices(expressionTypingServices);
137            forLoopConventionsChecker.setExpressionTypingUtils(expressionTypingUtils);
138            forLoopConventionsChecker.setProject(project);
139    
140            argumentTypeResolver.setExpressionTypingServices(expressionTypingServices);
141            argumentTypeResolver.setTypeResolver(typeResolver);
142    
143            candidateResolver.setArgumentTypeResolver(argumentTypeResolver);
144    
145        }
146        
147        @PreDestroy
148        public void destroy() {
149        }
150        
151        public ExpressionTypingServices getExpressionTypingServices() {
152            return this.expressionTypingServices;
153        }
154        
155        public ExpressionTypingComponents getExpressionTypingComponents() {
156            return this.expressionTypingComponents;
157        }
158        
159        public CallResolver getCallResolver() {
160            return this.callResolver;
161        }
162        
163    }