From f11b4fa6ca72b7bc81542cc5a6114ffaeec5c24e Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Tue, 31 Jul 2018 22:36:46 -0400 Subject: [PATCH] Rename import argument to reflect changed type --- vm/src/import.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/vm/src/import.rs b/vm/src/import.rs index cab5da49b..4cc2788e5 100644 --- a/vm/src/import.rs +++ b/vm/src/import.rs @@ -13,14 +13,15 @@ use super::compile; use super::pyobject::{Executor, PyObject, PyObjectKind, PyResult}; use super::vm::VirtualMachine; -pub fn import(rt: &mut VirtualMachine, name: &String) -> PyResult { +pub fn import(vm: &mut VirtualMachine, name: &String) -> PyResult { // Time to search for module in any place: // TODO: handle 'import sys' as special case? - let filepath = find_source(name).map_err(|e| rt.new_exception(format!("Error: {:?}", e)))?; - let source = parser::read_file(filepath.as_path()).map_err(|e| rt.new_exception(format!("Error: {:?}", e)))?; + let filepath = find_source(name).map_err(|e| vm.new_exception(format!("Error: {:?}", e)))?; + let source = parser::read_file(filepath.as_path()) + .map_err(|e| vm.new_exception(format!("Error: {:?}", e)))?; - let code_obj = match compile::compile(rt, &source, compile::Mode::Exec) { + let code_obj = match compile::compile(vm, &source, compile::Mode::Exec) { Ok(bytecode) => { debug!("Code object: {:?}", bytecode); bytecode @@ -30,10 +31,10 @@ pub fn import(rt: &mut VirtualMachine, name: &String) -> PyResult { } }; - let builtins = rt.get_builtin_scope(); - let scope = rt.new_scope(Some(builtins)); + let builtins = vm.get_builtin_scope(); + let scope = vm.new_scope(Some(builtins)); - match rt.run_code_obj(code_obj, scope.clone()) { + match vm.run_code_obj(code_obj, scope.clone()) { Ok(value) => {} Err(value) => return Err(value), } @@ -43,7 +44,7 @@ pub fn import(rt: &mut VirtualMachine, name: &String) -> PyResult { name: name.clone(), dict: scope.clone(), }, - rt.get_type(), + vm.get_type(), ); Ok(obj) }