优化
This commit is contained in:
@@ -98,10 +98,9 @@ internal class RhinoCompiledScript(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun eval(scope: Scriptable, coroutineContext: CoroutineContext?): Any? {
|
override fun eval(scope: Scriptable, coroutineContext: CoroutineContext?): Any? {
|
||||||
val cx = Context.enter()
|
val cx = Context.enter() as RhinoContext
|
||||||
if (cx is RhinoContext) {
|
val previousCoroutineContext = cx.coroutineContext
|
||||||
cx.coroutineContext = coroutineContext
|
cx.coroutineContext = coroutineContext
|
||||||
}
|
|
||||||
val result: Any?
|
val result: Any?
|
||||||
try {
|
try {
|
||||||
val ret = script.exec(cx, scope)
|
val ret = script.exec(cx, scope)
|
||||||
@@ -117,6 +116,7 @@ internal class RhinoCompiledScript(
|
|||||||
se.initCause(re)
|
se.initCause(re)
|
||||||
throw se
|
throw se
|
||||||
} finally {
|
} finally {
|
||||||
|
cx.coroutineContext = previousCoroutineContext
|
||||||
Context.exit()
|
Context.exit()
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user