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.codegen.inline;
018    
019    import org.jetbrains.asm4.Type;
020    
021    import java.util.List;
022    import java.util.Map;
023    
024    public class ConstructorInvocation {
025    
026        private final String ownerInternalName;
027    
028        private final Map<Integer, LambdaInfo> lambdasToInline;
029    
030        private final boolean isSameModule;
031    
032        private Type newLambdaType;
033    
034        private String newConstructorDescriptor;
035    
036        private List<CapturedParamInfo> allRecapturedParameters;
037    
038        private Map<String, LambdaInfo> capturedLambdasToInline;
039    
040        ConstructorInvocation(String ownerInternalName, Map<Integer, LambdaInfo> lambdasToInline, boolean isSameModule) {
041            this.ownerInternalName = ownerInternalName;
042            this.lambdasToInline = lambdasToInline;
043            this.isSameModule = isSameModule;
044        }
045    
046        public String getOwnerInternalName() {
047            return ownerInternalName;
048        }
049    
050        public boolean shouldRegenerate() {
051            return !lambdasToInline.isEmpty() || !isSameModule;
052        }
053    
054        public Map<Integer, LambdaInfo> getLambdasToInline() {
055            return lambdasToInline;
056        }
057    
058        public Type getNewLambdaType() {
059            return newLambdaType;
060        }
061    
062        public void setNewLambdaType(Type newLambdaType) {
063            this.newLambdaType = newLambdaType;
064        }
065    
066        public String getNewConstructorDescriptor() {
067            return newConstructorDescriptor;
068        }
069    
070        public void setNewConstructorDescriptor(String newConstructorDescriptor) {
071            this.newConstructorDescriptor = newConstructorDescriptor;
072        }
073    
074        public List<CapturedParamInfo> getAllRecapturedParameters() {
075            return allRecapturedParameters;
076        }
077    
078        public void setAllRecapturedParameters(List<CapturedParamInfo> allRecapturedParameters) {
079            this.allRecapturedParameters = allRecapturedParameters;
080        }
081    
082        public Map<String, LambdaInfo> getCapturedLambdasToInline() {
083            return capturedLambdasToInline;
084        }
085    
086        public void setCapturedLambdasToInline(Map<String, LambdaInfo> capturedLambdasToInline) {
087            this.capturedLambdasToInline = capturedLambdasToInline;
088        }
089    }