JS: don't remove debugger statement from coroutine
See KT-19826
This commit is contained in:
@@ -338,6 +338,10 @@ class CoroutineBodyTransformer(private val context: CoroutineTransformationConte
|
||||
currentStatements += x
|
||||
}
|
||||
|
||||
override fun visitDebugger(x: JsDebugger) {
|
||||
currentStatements += x
|
||||
}
|
||||
|
||||
private fun handleExpression(expression: JsExpression): JsExpression? {
|
||||
val assignment = JsAstUtils.decomposeAssignment(expression)
|
||||
if (assignment != null) {
|
||||
|
||||
@@ -944,6 +944,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/coroutines"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("debugStatement.kt")
|
||||
public void testDebugStatement() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/coroutines/debugStatement.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localVarOptimization.kt")
|
||||
public void testLocalVarOptimization() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/coroutines/localVarOptimization.kt");
|
||||
|
||||
@@ -205,6 +205,8 @@ public class DirectiveTestUtils {
|
||||
|
||||
private static final DirectiveHandler COUNT_NULLS = new CountNodesDirective<>("CHECK_NULLS_COUNT", JsNullLiteral.class);
|
||||
|
||||
private static final DirectiveHandler COUNT_DEBUGGER = new CountNodesDirective<>("CHECK_DEBUGGER_COUNT", JsDebugger.class);
|
||||
|
||||
private static final DirectiveHandler NOT_REFERENCED = new DirectiveHandler("CHECK_NOT_REFERENCED") {
|
||||
@Override
|
||||
void processEntry(@NotNull JsNode ast, @NotNull ArgumentsHelper arguments) throws Exception {
|
||||
@@ -337,6 +339,7 @@ public class DirectiveTestUtils {
|
||||
COUNT_VARS,
|
||||
COUNT_BREAKS,
|
||||
COUNT_NULLS,
|
||||
COUNT_DEBUGGER,
|
||||
NOT_REFERENCED,
|
||||
HAS_INLINE_METADATA,
|
||||
HAS_NO_INLINE_METADATA,
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1152
|
||||
// CHECK_DEBUGGER_COUNT: function=doResume count=1
|
||||
|
||||
fun foo(f: suspend () -> Unit) {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo {
|
||||
println("aaa")
|
||||
js("debugger;")
|
||||
println("bbb")
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user