Skip to content

Commit 050a1e7

Browse files
Alexey AndreevAlexey Andreev
authored andcommitted
JS: fix translation of call to suspend function with optional parameters
1 parent 3e436d4 commit 050a1e7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

js/js.translator/src/org/jetbrains/kotlin/js/translate/reference/CallArgumentTranslator.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.google.dart.compiler.backend.js.ast.metadata.SideEffectKind
2121
import com.google.dart.compiler.backend.js.ast.metadata.sideEffects
2222
import com.intellij.util.SmartList
2323
import org.jetbrains.kotlin.descriptors.ClassDescriptor
24+
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
2425
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
2526
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
2627
import org.jetbrains.kotlin.js.translate.context.Namer
@@ -157,7 +158,11 @@ class CallArgumentTranslator private constructor(
157158
}
158159
}
159160

160-
removeLastUndefinedArguments(result)
161+
val callableDescriptor = resolvedCall.resultingDescriptor
162+
if (callableDescriptor !is FunctionDescriptor || !callableDescriptor.isSuspend) {
163+
removeLastUndefinedArguments(result)
164+
}
165+
161166
return ArgumentsInfo(result, hasSpreadOperator, cachedReceiver)
162167
}
163168

0 commit comments

Comments
 (0)