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        private boolean capturedOuterRegenerated;
041    
042        ConstructorInvocation(
043                String ownerInternalName,
044                Map<Integer, LambdaInfo> lambdasToInline,
045                boolean isSameModule,
046                boolean capturedOuterRegenerated
047        ) {
048            this.ownerInternalName = ownerInternalName;
049            this.lambdasToInline = lambdasToInline;
050            this.isSameModule = isSameModule;
051            this.capturedOuterRegenerated = capturedOuterRegenerated;
052        }
053    
054        public String getOwnerInternalName() {
055            return ownerInternalName;
056        }
057    
058        public boolean shouldRegenerate() {
059            return !lambdasToInline.isEmpty() || !isSameModule || capturedOuterRegenerated;
060        }
061    
062        public Map<Integer, LambdaInfo> getLambdasToInline() {
063            return lambdasToInline;
064        }
065    
066        public Type getNewLambdaType() {
067            return newLambdaType;
068        }
069    
070        public void setNewLambdaType(Type newLambdaType) {
071            this.newLambdaType = newLambdaType;
072        }
073    
074        public String getNewConstructorDescriptor() {
075            return newConstructorDescriptor;
076        }
077    
078        public void setNewConstructorDescriptor(String newConstructorDescriptor) {
079            this.newConstructorDescriptor = newConstructorDescriptor;
080        }
081    
082        public List<CapturedParamInfo> getAllRecapturedParameters() {
083            return allRecapturedParameters;
084        }
085    
086        public void setAllRecapturedParameters(List<CapturedParamInfo> allRecapturedParameters) {
087            this.allRecapturedParameters = allRecapturedParameters;
088        }
089    
090        public Map<String, LambdaInfo> getCapturedLambdasToInline() {
091            return capturedLambdasToInline;
092        }
093    
094        public void setCapturedLambdasToInline(Map<String, LambdaInfo> capturedLambdasToInline) {
095            this.capturedLambdasToInline = capturedLambdasToInline;
096        }
097    
098    }