[JS IR] IC close input streams
^KT-51853 Fixed
This commit is contained in:
committed by
Space
parent
92d9c5b150
commit
c4bb445c01
@@ -18,7 +18,9 @@ class SrcFileArtifact(val srcFilePath: String, private val fragment: JsIrProgram
|
|||||||
return fragment
|
return fragment
|
||||||
}
|
}
|
||||||
return astArtifact?.ifExists { readBytes() }?.let {
|
return astArtifact?.ifExists { readBytes() }?.let {
|
||||||
deserializer.deserialize(ByteArrayInputStream(it))
|
ByteArrayInputStream(it).use { byteStream ->
|
||||||
|
deserializer.deserialize(byteStream)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ internal fun File.recreate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal inline fun <T> File.useCodedInputIfExists(f: CodedInputStream.() -> T) = ifExists {
|
internal inline fun <T> File.useCodedInputIfExists(f: CodedInputStream.() -> T) = ifExists {
|
||||||
CodedInputStream.newInstance(FileInputStream(this)).f()
|
FileInputStream(this).use {
|
||||||
|
CodedInputStream.newInstance(it).f()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal inline fun File.useCodedOutput(f: CodedOutputStream.() -> Unit) {
|
internal inline fun File.useCodedOutput(f: CodedOutputStream.() -> Unit) {
|
||||||
|
|||||||
Reference in New Issue
Block a user