FIR JS: enable full JS box tests with FIR

This commit is contained in:
Ilya Chernikov
2022-07-06 13:01:03 +02:00
parent 30df65c321
commit fa0cda6236
17 changed files with 343 additions and 69 deletions
@@ -6,20 +6,19 @@
package org.jetbrains.kotlin.test.services
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.library.KotlinLibrary
class JsLibraryProvider(private val testServices: TestServices) : TestService {
private val descriptorToLibrary = mutableMapOf<ModuleDescriptor, KotlinLibrary>()
private val stdlibPathToDescriptor = mutableMapOf<String, ModuleDescriptorImpl>()
private val stdlibPathToDescriptor = mutableMapOf<String, ModuleDescriptor>()
fun getDescriptorByPath(path: String): ModuleDescriptorImpl {
fun getDescriptorByPath(path: String): ModuleDescriptor {
return stdlibPathToDescriptor[path] ?: testServices.assertions.fail {
"There is no library with path $path"
}
}
fun setDescriptorAndLibraryByName(name: String, descriptor: ModuleDescriptorImpl, library: KotlinLibrary) {
fun setDescriptorAndLibraryByName(name: String, descriptor: ModuleDescriptor, library: KotlinLibrary) {
stdlibPathToDescriptor[name] = descriptor
descriptorToLibrary[descriptor] = library
}
@@ -40,7 +39,7 @@ class JsLibraryProvider(private val testServices: TestServices) : TestService {
}
}
fun getOrCreateStdlibByPath(path: String, create: (String) -> Pair<ModuleDescriptorImpl, KotlinLibrary>): ModuleDescriptorImpl {
fun getOrCreateStdlibByPath(path: String, create: (String) -> Pair<ModuleDescriptor, KotlinLibrary>): ModuleDescriptor {
return stdlibPathToDescriptor.getOrPut(path) {
create(path).let {
descriptorToLibrary += it