JS: fix NPE in incremental compilation
Fix NPE when compiling project incrementally and a file which is not recompiled contains try/catch statement
This commit is contained in:
@@ -93,7 +93,7 @@ public class JsCatch extends SourceInfoAwareJsNode implements HasCondition {
|
||||
@NotNull
|
||||
@Override
|
||||
public JsCatch deepCopy() {
|
||||
JsCatchScope scopeCopy = scope.copy();
|
||||
JsCatchScope scopeCopy = scope != null ? scope.copy() : null;
|
||||
JsBlock bodyCopy = AstUtil.deepCopy(body);
|
||||
JsExpression conditionCopy = AstUtil.deepCopy(condition);
|
||||
JsParameter paramCopy = AstUtil.deepCopy(param);
|
||||
|
||||
@@ -3443,6 +3443,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/incremental"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("catchScope.kt")
|
||||
public void testCatchScope() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/incremental/catchScope.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("coroutines.kt")
|
||||
public void testCoroutines() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/incremental/coroutines.kt");
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// FILE: a.kt
|
||||
|
||||
inline fun baz(): String =
|
||||
try {
|
||||
"OK"
|
||||
}
|
||||
catch (e: Exception) {
|
||||
"not OK"
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
// RECOMPILE
|
||||
|
||||
fun box(): String {
|
||||
return baz()
|
||||
}
|
||||
Reference in New Issue
Block a user