Scripting: switch legacy CLI REPL to the new infrastructure

This commit is contained in:
Ilya Chernikov
2022-05-13 20:44:44 +02:00
committed by teamcity
parent 6784cb63aa
commit b36d1be5f8
16 changed files with 185 additions and 62 deletions
@@ -98,7 +98,7 @@ abstract class KotlinJsr223JvmScriptEngineBase(protected val myFactory: ScriptEn
is ReplEvalResult.Error ->
when {
result is ReplEvalResult.Error.Runtime && result.cause != null ->
throw ScriptException(result.cause)
throw ScriptException((result.cause as? java.lang.Exception) ?: RuntimeException(result.cause))
result is ReplEvalResult.Error.CompileTime && result.location != null ->
throw ScriptException(result.message, result.location.path, result.location.line, result.location.column)
else -> throw ScriptException(result.message)
@@ -148,7 +148,7 @@ sealed class ReplEvalResult : Serializable {
}
sealed class Error(val message: String) : ReplEvalResult() {
class Runtime(message: String, val cause: Exception? = null) : Error(message) {
class Runtime(message: String, val cause: Throwable? = null) : Error(message) {
companion object { private val serialVersionUID: Long = 1L }
}