001 /*
002 * Copyright 2010-2013 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 org.jetbrains.jet.codegen.state.JetTypeMapper;
020 import org.jetbrains.jet.codegen.state.GenerationState;
021 import org.jetbrains.jet.codegen.ClassBuilderFactory;
022 import com.intellij.openapi.project.Project;
023 import org.jetbrains.jet.lang.resolve.BindingTrace;
024 import org.jetbrains.jet.lang.resolve.BindingContext;
025 import org.jetbrains.jet.codegen.ClassBuilderMode;
026 import org.jetbrains.jet.codegen.ScriptCodegen;
027 import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods;
028 import org.jetbrains.jet.codegen.ClassFileFactory;
029 import org.jetbrains.annotations.NotNull;
030 import javax.annotation.PreDestroy;
031
032 /* This file is generated by org.jetbrains.jet.generators.injectors.GenerateInjectors. DO NOT EDIT! */
033 public class InjectorForJvmCodegen {
034
035 private final JetTypeMapper jetTypeMapper;
036 private final GenerationState generationState;
037 private final ClassBuilderFactory classBuilderFactory;
038 private final Project project;
039 private final BindingTrace bindingTrace;
040 private final BindingContext bindingContext;
041 private final ClassBuilderMode classBuilderMode;
042 private final ScriptCodegen scriptCodegen;
043 private final IntrinsicMethods intrinsics;
044 private final ClassFileFactory classFileFactory;
045
046 public InjectorForJvmCodegen(
047 @NotNull JetTypeMapper jetTypeMapper,
048 @NotNull GenerationState generationState,
049 @NotNull ClassBuilderFactory classBuilderFactory,
050 @NotNull Project project
051 ) {
052 this.jetTypeMapper = jetTypeMapper;
053 this.generationState = generationState;
054 this.classBuilderFactory = classBuilderFactory;
055 this.project = project;
056 this.bindingTrace = jetTypeMapper.getBindingTrace();
057 this.bindingContext = bindingTrace.getBindingContext();
058 this.classBuilderMode = classBuilderFactory.getClassBuilderMode();
059 this.scriptCodegen = new ScriptCodegen(getGenerationState());
060 this.intrinsics = new IntrinsicMethods();
061 this.classFileFactory = new ClassFileFactory(getGenerationState());
062
063 this.scriptCodegen.setClassFileFactory(classFileFactory);
064
065 this.classFileFactory.setBuilderFactory(classBuilderFactory);
066
067 intrinsics.init();
068
069 }
070
071 @PreDestroy
072 public void destroy() {
073 }
074
075 public JetTypeMapper getJetTypeMapper() {
076 return this.jetTypeMapper;
077 }
078
079 public GenerationState getGenerationState() {
080 return this.generationState;
081 }
082
083 public Project getProject() {
084 return this.project;
085 }
086
087 public ScriptCodegen getScriptCodegen() {
088 return this.scriptCodegen;
089 }
090
091 public IntrinsicMethods getIntrinsics() {
092 return this.intrinsics;
093 }
094
095 public ClassFileFactory getClassFileFactory() {
096 return this.classFileFactory;
097 }
098
099 }