Fix imported script functionality in JSR-223/REPL:

- setup compilation properly to take imported scripts into account
- add compiled imported scripts into generated results
= calculate ScriptLightVirtualFile path as relative - simplifies imported scripts location
This commit is contained in:
Ilya Chernikov
2019-09-04 16:18:12 +02:00
parent 0fe137d75c
commit 771f5c13dd
6 changed files with 27 additions and 8 deletions
@@ -30,7 +30,6 @@ import kotlin.script.experimental.dependencies.ScriptDependencies
import kotlin.script.experimental.host.*
import kotlin.script.experimental.jvm.*
import kotlin.script.experimental.jvm.compat.mapToDiagnostics
import kotlin.script.experimental.jvm.impl.refineWith
import kotlin.script.experimental.jvm.impl.toClassPathOrEmpty
import kotlin.script.experimental.jvm.impl.toDependencies
@@ -97,7 +96,8 @@ class ScriptLightVirtualFile(name: String, private val _path: String?, text: Str
charset = CharsetToolkit.UTF8_CHARSET
}
override fun getPath(): String = _path ?: super.getPath()
override fun getPath(): String = _path ?: if (parent != null) parent.path + "/" + name else name
override fun getCanonicalPath(): String? = path
}