Skip to content

Commit d39b8df

Browse files
committed
Fix wasm
1 parent 7ab95fd commit d39b8df

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

crates/wasm/src/vm_class.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,31 +323,27 @@ impl WASMVirtualMachine {
323323
&self,
324324
source: &str,
325325
mode: Mode,
326-
source_path: Option<String>,
326+
source_path: Option<&str>,
327327
) -> Result<JsValue, JsValue> {
328328
self.with_vm(|vm, StoredVirtualMachine { scope, .. }| {
329-
let source_path = source_path.unwrap_or_else(|| "<wasm>".to_owned());
329+
let source_path = source_path.unwrap_or("<wasm>");
330330
let code = vm.compile(source, mode, source_path);
331331
let code = code.map_err(convert::syntax_err)?;
332332
let result = vm.run_code_obj(code, scope.clone());
333333
convert::pyresult_to_js_result(vm, result)
334334
})?
335335
}
336336

337-
pub fn exec(&self, source: &str, source_path: Option<String>) -> Result<JsValue, JsValue> {
337+
pub fn exec(&self, source: &str, source_path: Option<&str>) -> Result<JsValue, JsValue> {
338338
self.run(source, Mode::Exec, source_path)
339339
}
340340

341-
pub fn eval(&self, source: &str, source_path: Option<String>) -> Result<JsValue, JsValue> {
341+
pub fn eval(&self, source: &str, source_path: Option<&str>) -> Result<JsValue, JsValue> {
342342
self.run(source, Mode::Eval, source_path)
343343
}
344344

345345
#[wasm_bindgen(js_name = execSingle)]
346-
pub fn exec_single(
347-
&self,
348-
source: &str,
349-
source_path: Option<String>,
350-
) -> Result<JsValue, JsValue> {
346+
pub fn exec_single(&self, source: &str, source_path: Option<&str>) -> Result<JsValue, JsValue> {
351347
self.run(source, Mode::Single, source_path)
352348
}
353349
}

0 commit comments

Comments
 (0)