[JS IR] Use mappedNames in NameTable only for REPL
And throw exception for unsupported types in mapToKey
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.scripting.repl.js.readLibrariesFromConfiguration
|
||||
import kotlin.script.experimental.api.*
|
||||
|
||||
class JsScriptCompilerWithDependenciesProxy(private val environment: KotlinCoreEnvironment) : ScriptCompilerProxy {
|
||||
private val nameTables = NameTables(emptyList())
|
||||
private val nameTables = NameTables(emptyList(), mappedNames = mutableMapOf())
|
||||
private val symbolTable = SymbolTable(IdSignatureDescriptor(JsManglerDesc), IrFactoryImpl)
|
||||
private val dependencies: List<ModuleDescriptor> = readLibrariesFromConfiguration(environment.configuration)
|
||||
private val compiler = JsCoreScriptingCompiler(environment, nameTables, symbolTable, dependencies)
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@ class JsReplCompiler(private val environment: KotlinCoreEnvironment) : ReplCompi
|
||||
override fun createState(lock: ReentrantReadWriteLock): IReplStageState<*> {
|
||||
return JsReplCompilationState(
|
||||
lock,
|
||||
NameTables(emptyList()),
|
||||
NameTables(emptyList(), mappedNames = mutableMapOf()),
|
||||
readLibrariesFromConfiguration(environment.configuration),
|
||||
ReplCodeAnalyzerBase.ResettableAnalyzerState(),
|
||||
SymbolTable(IdSignatureDescriptor(JsManglerDesc), IrFactoryImpl)
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -172,7 +172,7 @@ class DependencyLoader {
|
||||
|
||||
fun writeNames(nameTables: NameTables): ByteArray {
|
||||
val result = StringBuilder()
|
||||
for (entry in nameTables.mappedNames) {
|
||||
for (entry in nameTables.mappedNames.orEmpty()) {
|
||||
result.append("${entry.key} ${entry.value}" + System.lineSeparator())
|
||||
}
|
||||
return result.toString().toByteArray(Charset.defaultCharset())
|
||||
|
||||
Reference in New Issue
Block a user