Make code generation in method transformer more stable

Do not mix references to label nodes and common ASM labels
as it may lead to different LabelNode instance (not defaultLabel)
being inserted into insns list

It's been working before because there was no `resetLabels` call
on insnList, and label/label nodes were bound to each other
This commit is contained in:
Denis Zharkov
2017-05-12 15:38:10 +03:00
parent 4033786902
commit dcaad530ce
@@ -125,9 +125,9 @@ class CoroutineTransformerMethodVisitor(
)
insert(startLabel, withInstructionAdapter { generateResumeWithExceptionCheck(exceptionIndex) })
insert(last, defaultLabel)
insert(last, withInstructionAdapter {
visitLabel(defaultLabel.label)
AsmUtil.genThrow(this, "java/lang/IllegalStateException", "call to 'resume' before 'invoke' with coroutine")
areturn(Type.VOID_TYPE)
})