Convert InlinedLambdaRemapper to Kotlin

This commit is contained in:
Mikhael Bogdanov
2017-05-15 19:58:05 +02:00
parent d1fdfd484b
commit fcd76e6dec
@@ -14,46 +14,33 @@
* 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.org.objectweb.asm.tree.FieldInsnNode
import org.jetbrains.kotlin.codegen.StackValue;
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode;
import java.util.Collection; class InlinedLambdaRemapper(
lambdaInternalName: String,
parent: FieldRemapper,
methodParams: Parameters
) : FieldRemapper(lambdaInternalName, parent, methodParams) {
public class InlinedLambdaRemapper extends FieldRemapper { public override fun canProcess(fieldOwner: String, fieldName: String, isFolding: Boolean): Boolean {
public InlinedLambdaRemapper( return isFolding && super.canProcess(fieldOwner, fieldName, true)
@NotNull String lambdaInternalName,
@NotNull FieldRemapper parent,
@NotNull Parameters methodParams
) {
super(lambdaInternalName, parent, methodParams);
} }
@Override public override fun findField(fieldInsnNode: FieldInsnNode, captured: Collection<CapturedParamInfo>): CapturedParamInfo? {
public boolean canProcess(@NotNull String fieldOwner, @NotNull String fieldName, boolean isFolding) { return parent.findField(fieldInsnNode, captured)
return isFolding && super.canProcess(fieldOwner, fieldName, true);
} }
@Override override fun isInsideInliningLambda(): Boolean {
@Nullable return true
public CapturedParamInfo findField(@NotNull FieldInsnNode fieldInsnNode, @NotNull Collection<CapturedParamInfo> captured) {
return parent.findField(fieldInsnNode, captured);
} }
@Override override fun getFieldForInline(node: FieldInsnNode, prefix: StackValue?): StackValue? {
public boolean isInsideInliningLambda() { if (parent.isRoot) {
return true; return super.getFieldForInline(node, prefix)
}
@Nullable
@Override
public StackValue getFieldForInline(@NotNull FieldInsnNode node, @Nullable StackValue prefix) {
if (parent.isRoot()) {
return super.getFieldForInline(node, prefix);
} }
return parent.getFieldForInline(node, prefix); return parent.getFieldForInline(node, prefix)
} }
} }