fix(scripting): optimization level
This commit is contained in:
@@ -183,7 +183,9 @@ class JSModule(
|
||||
else -> moduleBindings[bindingName]?.getObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contextScope(shouldOptimize = true) {
|
||||
evaluateString(moduleObject, content, moduleInfo.name, 1, null)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,10 @@ import java.io.File
|
||||
|
||||
private val rhinoAndroidHelper = RhinoAndroidHelper(null as File?)
|
||||
|
||||
fun contextScope(f: Context.() -> Any?): Any? {
|
||||
fun contextScope(shouldOptimize: Boolean = false, f: Context.() -> Any?): Any? {
|
||||
val context = rhinoAndroidHelper.enterContext().apply {
|
||||
languageVersion = Context.VERSION_ES6
|
||||
optimizationLevel = if (!shouldOptimize) -1 else 0
|
||||
}
|
||||
try {
|
||||
return context.f().let {
|
||||
|
||||
Reference in New Issue
Block a user