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