Support getValue/setValue/provideDelegate suspend functions in JVM backend
- Determine if there are non-tail calls to getValue/setValue simply by existance of such a property (it might be too strict, but implementing more granular check may be rather hard) - Change in ExpressionCodegen is relevant for provideDelegate, that in case of local variables uses OnStack as StackValue (see the comment near these changes) #KT-15933 Fixed
This commit is contained in:
@@ -829,6 +829,19 @@ class ControlFlowInformationProvider private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
pseudocode.traverse(TraversalOrder.FORWARD) { instruction ->
|
||||
if (instruction !is VariableDeclarationInstruction || instruction.element !is KtProperty || !instruction.element.hasDelegate()) return@traverse
|
||||
|
||||
val variableDescriptor =
|
||||
trace[BindingContext.DECLARATION_TO_DESCRIPTOR, instruction.element] as? VariableDescriptorWithAccessors
|
||||
?: return@traverse
|
||||
|
||||
containsNonTailCalls =
|
||||
containsNonTailCalls || variableDescriptor.accessors.any {
|
||||
trace[BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL, it]?.candidateDescriptor?.isSuspend == true
|
||||
}
|
||||
}
|
||||
|
||||
if (containsNonTailCalls) {
|
||||
trace.record(BindingContext.CONTAINS_NON_TAIL_SUSPEND_CALLS, currentFunction.original)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user