Implement import test, fix import support in compiler and evaluator
This commit is contained in:
+2
-1
@@ -14,6 +14,7 @@ import kotlin.script.experimental.dependencies.AsyncDependenciesResolver
|
||||
import kotlin.script.experimental.dependencies.DependenciesResolver
|
||||
import kotlin.script.experimental.dependencies.ScriptDependencies
|
||||
import kotlin.script.experimental.dependencies.ScriptReport
|
||||
import kotlin.script.experimental.host.FileScriptSource
|
||||
import kotlin.script.experimental.host.toScriptSource
|
||||
import kotlin.script.experimental.jvm.JvmDependency
|
||||
import kotlin.script.experimental.jvm.compat.mapToLegacyScriptReportPosition
|
||||
@@ -94,8 +95,8 @@ internal fun List<ScriptDiagnostic>.mapScriptReportsToDiagnostics() =
|
||||
map { ScriptReport(it.message, mapToLegacyScriptReportSeverity(it.severity), mapToLegacyScriptReportPosition(it.location)) }
|
||||
|
||||
internal fun ScriptContents.toScriptSource(): SourceCode = when {
|
||||
file != null -> FileScriptSource(file!!, text?.toString())
|
||||
text != null -> text!!.toString().toScriptSource()
|
||||
file != null -> file!!.toScriptSource()
|
||||
else -> throw IllegalArgumentException("Unable to convert script contents $this into script source")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user