mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user