This commit is contained in:
Xwite
2023-03-25 18:13:21 +08:00
parent bb17a52b34
commit e21781e580

View File

@@ -74,33 +74,6 @@ class RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
return unwrapReturnValue(ret)
}
@Throws(ScriptException::class)
override fun eval(reader: Reader, context: ScriptContext): Any? {
val cx = Context.enter()
val ret: Any?
try {
val scope = getRuntimeScope(context)
var filename = this["javax.script.filename"] as? String
filename = filename ?: "<Unknown source>"
ret = cx.evaluateReader(scope, reader, filename, 1, null)
} catch (re: RhinoException) {
val line = if (re.lineNumber() == 0) -1 else re.lineNumber()
val msg: String = if (re is JavaScriptException) {
re.value.toString()
} else {
re.toString()
}
val se = ScriptException(msg, re.sourceName(), line)
se.initCause(re)
throw se
} catch (var14: IOException) {
throw ScriptException(var14)
} finally {
Context.exit()
}
return unwrapReturnValue(ret)
}
override fun createBindings(): Bindings {
return SimpleBindings()
}