001    /*
002     * Copyright 2010-2015 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.kotlin.codegen.inline;
018    
019    import org.jetbrains.annotations.NotNull;
020    import org.jetbrains.org.objectweb.asm.Type;
021    
022    public class CapturedParamDesc {
023        private final CapturedParamOwner containingLambda;
024        private final String fieldName;
025        private final Type type;
026    
027        public CapturedParamDesc(@NotNull CapturedParamOwner containingLambda, @NotNull String fieldName, @NotNull Type type) {
028            this.containingLambda = containingLambda;
029            this.fieldName = fieldName;
030            this.type = type;
031        }
032    
033        @NotNull
034        public String getContainingLambdaName() {
035            return containingLambda.getType().getInternalName();
036        }
037    
038        @NotNull
039        public String getFieldName() {
040            return fieldName;
041        }
042    
043        @NotNull
044        public Type getType() {
045            return type;
046        }
047    
048        @NotNull
049        public static CapturedParamDesc createDesc(@NotNull CapturedParamOwner containingLambdaInfo, @NotNull String fieldName, @NotNull Type type) {
050            return new CapturedParamDesc(containingLambdaInfo, fieldName, type);
051        }
052    }