Convert CapturedParamInfo.java into Kotlin
This commit is contained in:
@@ -14,80 +14,63 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.codegen.inline;
|
package org.jetbrains.kotlin.codegen.inline
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.kotlin.codegen.StackValue
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.jetbrains.kotlin.codegen.StackValue;
|
|
||||||
|
|
||||||
public class CapturedParamInfo extends ParameterInfo {
|
class CapturedParamInfo : ParameterInfo {
|
||||||
public final CapturedParamDesc desc;
|
val desc: CapturedParamDesc
|
||||||
private final String newFieldName;
|
val newFieldName: String
|
||||||
private final boolean skipInConstructor;
|
val isSkipInConstructor: Boolean
|
||||||
|
|
||||||
//Now used only for bound function reference receiver
|
//Now used only for bound function reference receiver
|
||||||
private boolean synthetic;
|
var isSynthetic: Boolean = false
|
||||||
|
|
||||||
public CapturedParamInfo(@NotNull CapturedParamDesc desc, @NotNull String newFieldName, boolean skipped, int index, int remapIndex) {
|
val originalFieldName: String
|
||||||
super(desc.getType(), skipped, index, remapIndex, -1);
|
get() = desc.fieldName
|
||||||
this.desc = desc;
|
|
||||||
this.newFieldName = newFieldName;
|
|
||||||
this.skipInConstructor = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CapturedParamInfo(
|
val containingLambdaName: String
|
||||||
@NotNull CapturedParamDesc desc,
|
get() = desc.containingLambdaName
|
||||||
@NotNull String newFieldName,
|
|
||||||
boolean skipped,
|
constructor(desc: CapturedParamDesc, newFieldName: String, skipped: Boolean, index: Int, remapIndex: Int) : super(
|
||||||
int index,
|
desc.type,
|
||||||
@Nullable StackValue remapIndex,
|
skipped,
|
||||||
boolean skipInConstructor,
|
index,
|
||||||
int declarationIndex
|
remapIndex,
|
||||||
|
-1
|
||||||
) {
|
) {
|
||||||
super(desc.getType(), skipped, index, remapIndex, declarationIndex);
|
this.desc = desc
|
||||||
this.desc = desc;
|
this.newFieldName = newFieldName
|
||||||
this.newFieldName = newFieldName;
|
this.isSkipInConstructor = false
|
||||||
this.skipInConstructor = skipInConstructor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
constructor(
|
||||||
public String getNewFieldName() {
|
desc: CapturedParamDesc,
|
||||||
return newFieldName;
|
newFieldName: String,
|
||||||
|
skipped: Boolean,
|
||||||
|
index: Int,
|
||||||
|
remapIndex: StackValue?,
|
||||||
|
skipInConstructor: Boolean,
|
||||||
|
declarationIndex: Int
|
||||||
|
) : super(desc.type, skipped, index, remapIndex, declarationIndex) {
|
||||||
|
this.desc = desc
|
||||||
|
this.newFieldName = newFieldName
|
||||||
|
this.isSkipInConstructor = skipInConstructor
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
fun cloneWithNewDeclarationIndex(newDeclarationIndex: Int): CapturedParamInfo {
|
||||||
public String getOriginalFieldName() {
|
val result = CapturedParamInfo(
|
||||||
return desc.getFieldName();
|
desc, newFieldName, isSkipped, index, remapValue, isSkipInConstructor, newDeclarationIndex
|
||||||
|
)
|
||||||
|
result.functionalArgument = functionalArgument
|
||||||
|
result.isSynthetic = isSynthetic
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
companion object {
|
||||||
public CapturedParamInfo cloneWithNewDeclarationIndex(int newDeclarationIndex) {
|
|
||||||
CapturedParamInfo result = new CapturedParamInfo(
|
|
||||||
desc, newFieldName, isSkipped(), getIndex(), getRemapValue(), skipInConstructor, newDeclarationIndex
|
|
||||||
);
|
|
||||||
result.setFunctionalArgument(getFunctionalArgument());
|
|
||||||
result.setSynthetic(synthetic);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
fun isSynthetic(info: ParameterInfo): Boolean {
|
||||||
public String getContainingLambdaName() {
|
return info is CapturedParamInfo && info.isSynthetic
|
||||||
return desc.getContainingLambdaName();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSkipInConstructor() {
|
|
||||||
return skipInConstructor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSynthetic() {
|
|
||||||
return synthetic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSynthetic(boolean synthetic) {
|
|
||||||
this.synthetic = synthetic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isSynthetic(@NotNull ParameterInfo info) {
|
|
||||||
return info instanceof CapturedParamInfo && ((CapturedParamInfo) info).isSynthetic();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user