(
&self,
source: &str,
mode: Mode,
source_path: Option<String>,
)
| 315 | } |
| 316 | |
| 317 | pub(crate) fn run( |
| 318 | &self, |
| 319 | source: &str, |
| 320 | mode: Mode, |
| 321 | source_path: Option<String>, |
| 322 | ) -> Result<JsValue, JsValue> { |
| 323 | self.with_vm(|vm, StoredVirtualMachine { scope, .. }| { |
| 324 | let source_path = source_path.unwrap_or_else(|| "<wasm>".to_owned()); |
| 325 | let code = vm.compile(source, mode, source_path); |
| 326 | let code = code.map_err(convert::syntax_err)?; |
| 327 | let result = vm.run_code_obj(code, scope.clone()); |
| 328 | convert::pyresult_to_js_result(vm, result) |
| 329 | })? |
| 330 | } |
| 331 | |
| 332 | pub fn exec(&self, source: &str, source_path: Option<String>) -> Result<JsValue, JsValue> { |
| 333 | self.run(source, Mode::Exec, source_path) |
no test coverage detected