InjectorForJvmCodegen.java 4.1 KB
Newer Older
S
Stepan Koltsov 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * Copyright 2010-2012 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package org.jetbrains.jet.di;

import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
import org.jetbrains.jet.lang.resolve.BindingContext;
import java.util.List;
import org.jetbrains.jet.lang.psi.JetFile;
S
Stepan Koltsov 已提交
24
import com.intellij.openapi.project.Project;
25
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
26
import org.jetbrains.jet.codegen.ClassBuilderMode;
S
Stepan Koltsov 已提交
27 28
import org.jetbrains.jet.codegen.GenerationState;
import org.jetbrains.jet.codegen.ClassBuilderFactory;
S
Stepan Koltsov 已提交
29
import org.jetbrains.jet.codegen.JetTypeMapper;
S
Stepan Koltsov 已提交
30
import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods;
S
Stepan Koltsov 已提交
31
import org.jetbrains.jet.codegen.ClassFileFactory;
S
Stepan Koltsov 已提交
32 33 34 35 36
import org.jetbrains.jet.codegen.ClosureAnnotator;
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
import org.jetbrains.jet.lang.resolve.BindingContext;
import java.util.List;
import org.jetbrains.jet.lang.psi.JetFile;
S
Stepan Koltsov 已提交
37
import com.intellij.openapi.project.Project;
38
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
39
import org.jetbrains.jet.codegen.ClassBuilderMode;
S
Stepan Koltsov 已提交
40 41
import org.jetbrains.jet.codegen.GenerationState;
import org.jetbrains.jet.codegen.ClassBuilderFactory;
S
Stepan Koltsov 已提交
42 43 44 45 46
import org.jetbrains.annotations.NotNull;

/* This file is generated by org.jetbrains.jet.di.AllInjectorsGenerator. DO NOT EDIT! */
public class InjectorForJvmCodegen {

S
Stepan Koltsov 已提交
47
    private final JetStandardLibrary jetStandardLibrary;
S
Stepan Koltsov 已提交
48
    private final GenerationState generationState;
S
Stepan Koltsov 已提交
49
    private JetTypeMapper jetTypeMapper;
S
Stepan Koltsov 已提交
50
    private IntrinsicMethods intrinsics;
S
Stepan Koltsov 已提交
51
    private ClassFileFactory classFileFactory;
S
Stepan Koltsov 已提交
52 53 54 55

    public InjectorForJvmCodegen(
        @NotNull JetStandardLibrary jetStandardLibrary,
        @NotNull BindingContext bindingContext,
S
Stepan Koltsov 已提交
56
        @NotNull List<JetFile> listOfJetFile,
S
Stepan Koltsov 已提交
57
        @NotNull Project project,
58
        @NotNull CompilerSpecialMode compilerSpecialMode,
59
        @NotNull ClassBuilderMode classBuilderMode,
S
Stepan Koltsov 已提交
60 61
        @NotNull GenerationState generationState,
        @NotNull ClassBuilderFactory classBuilderFactory
S
Stepan Koltsov 已提交
62
    ) {
S
Stepan Koltsov 已提交
63
        this.jetStandardLibrary = jetStandardLibrary;
S
Stepan Koltsov 已提交
64
        this.generationState = generationState;
S
Stepan Koltsov 已提交
65
        this.jetTypeMapper = new JetTypeMapper();
S
Stepan Koltsov 已提交
66
        this.intrinsics = new IntrinsicMethods();
S
Stepan Koltsov 已提交
67
        this.classFileFactory = new ClassFileFactory();
S
Stepan Koltsov 已提交
68 69 70
        ClosureAnnotator closureAnnotator = new ClosureAnnotator();

        this.jetTypeMapper.setBindingContext(bindingContext);
71
        this.jetTypeMapper.setClassBuilderMode(classBuilderMode);
S
Stepan Koltsov 已提交
72
        this.jetTypeMapper.setClosureAnnotator(closureAnnotator);
73
        this.jetTypeMapper.setCompilerSpecialMode(compilerSpecialMode);
S
Stepan Koltsov 已提交
74 75
        this.jetTypeMapper.setStandardLibrary(jetStandardLibrary);

S
Stepan Koltsov 已提交
76 77 78
        this.intrinsics.setMyProject(project);
        this.intrinsics.setMyStdLib(jetStandardLibrary);

S
Stepan Koltsov 已提交
79 80 81
        this.classFileFactory.setBuilderFactory(classBuilderFactory);
        this.classFileFactory.setState(generationState);

S
Stepan Koltsov 已提交
82 83 84 85 86
        closureAnnotator.setBindingContext(bindingContext);
        closureAnnotator.setFiles(listOfJetFile);

        jetTypeMapper.init();

S
Stepan Koltsov 已提交
87 88
        intrinsics.init();

S
Stepan Koltsov 已提交
89 90 91 92
        closureAnnotator.init();

    }

S
Stepan Koltsov 已提交
93 94 95 96
    public JetStandardLibrary getJetStandardLibrary() {
        return this.jetStandardLibrary;
    }

S
Stepan Koltsov 已提交
97 98 99 100
    public GenerationState getGenerationState() {
        return this.generationState;
    }

S
Stepan Koltsov 已提交
101 102 103 104
    public JetTypeMapper getJetTypeMapper() {
        return this.jetTypeMapper;
    }

S
Stepan Koltsov 已提交
105 106 107 108
    public IntrinsicMethods getIntrinsics() {
        return this.intrinsics;
    }

S
Stepan Koltsov 已提交
109 110 111 112
    public ClassFileFactory getClassFileFactory() {
        return this.classFileFactory;
    }

S
Stepan Koltsov 已提交
113
}