Fixed local return inside function expression.
This commit is contained in:
@@ -1820,7 +1820,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
@Nullable
|
||||
private NonLocalReturnInfo getNonLocalReturnInfo(@NotNull CallableMemberDescriptor descriptor, @NotNull JetReturnExpression expression) {
|
||||
//call inside lambda
|
||||
if (isLocalFunOrLambda(descriptor) && descriptor.getName().isSpecial()) {
|
||||
if (isLambda(descriptor)) {
|
||||
if (expression.getLabelName() == null) {
|
||||
//non labeled return couldn't be local in lambda
|
||||
FunctionDescriptor containingFunction =
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.codegen.SamType;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.when.WhenByEnumsMapping;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
@@ -264,6 +265,10 @@ public class CodegenBinding {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isLambda(@Nullable DeclarationDescriptor fd) {
|
||||
return fd instanceof AnonymousFunctionDescriptor;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Type getAsmType(@NotNull BindingContext bindingContext, @NotNull ClassDescriptor klass) {
|
||||
Type type = bindingContext.get(ASM_TYPE, klass);
|
||||
|
||||
Reference in New Issue
Block a user