MCPcopy Index your code
hub / github.com/RustPython/RustPython / run

Method run

crates/wasm/src/vm_class.rs:317–330  ·  view source on GitHub ↗
(
        &self,
        source: &str,
        mode: Mode,
        source_path: Option<String>,
    )

Source from the content-addressed store, hash-verified

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)

Callers 4

run_pyFunction · 0.45
execMethod · 0.45
evalMethod · 0.45
exec_singleMethod · 0.45

Calls 6

pyresult_to_js_resultFunction · 0.85
with_vmMethod · 0.80
run_code_objMethod · 0.80
to_ownedMethod · 0.45
compileMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected