Inline util functions renaming
This commit is contained in:
@@ -152,7 +152,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
|
||||
@Nullable
|
||||
@Override
|
||||
protected ClassDescriptor classForInnerClassRecord() {
|
||||
return JvmCodegenUtil.isLambdaWhichWillBeInlined(bindingContext, funDescriptor) ? null : classDescriptor;
|
||||
return JvmCodegenUtil.isArgumentWhichWillBeInlined(bindingContext, funDescriptor) ? null : classDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1849,7 +1849,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
if (isFunctionLiteral(descriptor)) {
|
||||
//non labeled return couldn't be local in lambda
|
||||
FunctionDescriptor containingFunction =
|
||||
BindingContextUtils.getContainingFunctionSkipFunctionLiterals(descriptor, false).getFirst();
|
||||
BindingContextUtils.getContainingFunctionSkipFunctionLiterals(descriptor, true).getFirst();
|
||||
//FIRST_FUN_LABEL to prevent clashing with existing labels
|
||||
return new NonLocalReturnInfo(typeMapper.mapReturnType(containingFunction), InlineCodegenUtil.FIRST_FUN_LABEL);
|
||||
} else {
|
||||
|
||||
@@ -230,10 +230,10 @@ public class JvmCodegenUtil {
|
||||
: descriptor;
|
||||
}
|
||||
|
||||
public static boolean isLambdaWhichWillBeInlined(@NotNull BindingContext bindingContext, @NotNull DeclarationDescriptor descriptor) {
|
||||
public static boolean isArgumentWhichWillBeInlined(@NotNull BindingContext bindingContext, @NotNull DeclarationDescriptor descriptor) {
|
||||
PsiElement declaration = DescriptorToSourceUtils.descriptorToDeclaration(descriptor);
|
||||
return InlineUtil.isFunctionalExpression(declaration) &&
|
||||
InlineUtil.isInlineLambda((JetFunction)declaration, bindingContext, false);
|
||||
return InlineUtil.canBeInlineArgument(declaration) &&
|
||||
InlineUtil.isInlinedArgument((JetFunction) declaration, bindingContext, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -174,7 +174,7 @@ public class CodegenBinding {
|
||||
|
||||
// Note: at the moment this is needed for light classes only
|
||||
// TODO: refactor this out
|
||||
if (enclosing != null && !JvmCodegenUtil.isLambdaWhichWillBeInlined(trace.getBindingContext(), classDescriptor)) {
|
||||
if (enclosing != null && !JvmCodegenUtil.isArgumentWhichWillBeInlined(trace.getBindingContext(), classDescriptor)) {
|
||||
recordInnerClass(trace, enclosing, classDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -60,7 +59,6 @@ import java.util.*;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.getMethodAsmFlags;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil.addInlineMarker;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isFunctionExpression;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isFunctionLiteral;
|
||||
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getResolvedCallWithAssert;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user