Skip to content

Commit fcd76e6

Browse files
author
Mikhael Bogdanov
committed
Convert InlinedLambdaRemapper to Kotlin
1 parent d1fdfd4 commit fcd76e6

File tree

1 file changed

+18
-31
lines changed

1 file changed

+18
-31
lines changed

compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlinedLambdaRemapper.kt

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,33 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.jetbrains.kotlin.codegen.inline;
17+
package org.jetbrains.kotlin.codegen.inline
1818

19-
import org.jetbrains.annotations.NotNull;
20-
import org.jetbrains.annotations.Nullable;
21-
import org.jetbrains.kotlin.codegen.StackValue;
22-
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode;
19+
import org.jetbrains.kotlin.codegen.StackValue
20+
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode
2321

24-
import java.util.Collection;
22+
class InlinedLambdaRemapper(
23+
lambdaInternalName: String,
24+
parent: FieldRemapper,
25+
methodParams: Parameters
26+
) : FieldRemapper(lambdaInternalName, parent, methodParams) {
2527

26-
public class InlinedLambdaRemapper extends FieldRemapper {
27-
public InlinedLambdaRemapper(
28-
@NotNull String lambdaInternalName,
29-
@NotNull FieldRemapper parent,
30-
@NotNull Parameters methodParams
31-
) {
32-
super(lambdaInternalName, parent, methodParams);
28+
public override fun canProcess(fieldOwner: String, fieldName: String, isFolding: Boolean): Boolean {
29+
return isFolding && super.canProcess(fieldOwner, fieldName, true)
3330
}
3431

35-
@Override
36-
public boolean canProcess(@NotNull String fieldOwner, @NotNull String fieldName, boolean isFolding) {
37-
return isFolding && super.canProcess(fieldOwner, fieldName, true);
32+
public override fun findField(fieldInsnNode: FieldInsnNode, captured: Collection<CapturedParamInfo>): CapturedParamInfo? {
33+
return parent.findField(fieldInsnNode, captured)
3834
}
3935

40-
@Override
41-
@Nullable
42-
public CapturedParamInfo findField(@NotNull FieldInsnNode fieldInsnNode, @NotNull Collection<CapturedParamInfo> captured) {
43-
return parent.findField(fieldInsnNode, captured);
36+
override fun isInsideInliningLambda(): Boolean {
37+
return true
4438
}
4539

46-
@Override
47-
public boolean isInsideInliningLambda() {
48-
return true;
49-
}
50-
51-
@Nullable
52-
@Override
53-
public StackValue getFieldForInline(@NotNull FieldInsnNode node, @Nullable StackValue prefix) {
54-
if (parent.isRoot()) {
55-
return super.getFieldForInline(node, prefix);
40+
override fun getFieldForInline(node: FieldInsnNode, prefix: StackValue?): StackValue? {
41+
if (parent.isRoot) {
42+
return super.getFieldForInline(node, prefix)
5643
}
57-
return parent.getFieldForInline(node, prefix);
44+
return parent.getFieldForInline(node, prefix)
5845
}
5946
}

0 commit comments

Comments
 (0)