Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Jul 8, 2024
1 parent e19f8c4 commit ca3b467
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ internal class RhinoCompiledScript(
}

override fun eval(scope: Scriptable, coroutineContext: CoroutineContext?): Any? {
val cx = Context.enter()
if (cx is RhinoContext) {
cx.coroutineContext = coroutineContext
}
val cx = Context.enter() as RhinoContext
val previousCoroutineContext = cx.coroutineContext
cx.coroutineContext = coroutineContext
val result: Any?
try {
val ret = script.exec(cx, scope)
Expand All @@ -117,6 +116,7 @@ internal class RhinoCompiledScript(
se.initCause(re)
throw se
} finally {
cx.coroutineContext = previousCoroutineContext
Context.exit()
}
return result
Expand Down

0 comments on commit ca3b467

Please sign in to comment.