|
4 | 4 | //! <https://github.com/ProgVal/pythonvm-rust/blob/master/src/processor/mod.rs> |
5 | 5 |
|
6 | 6 | #[cfg(feature = "rustpython-compiler")] |
7 | | -use crate::compile::{self, CompileError, CompileOpts}; |
| 7 | +mod compile; |
| 8 | +mod interpreter; |
| 9 | +mod setting; |
| 10 | +pub mod thread; |
| 11 | +mod vm_new; |
| 12 | +mod vm_object; |
| 13 | +mod vm_ops; |
| 14 | + |
8 | 15 | use crate::{ |
9 | 16 | builtins::{ |
10 | 17 | code::{self, PyCode}, |
@@ -32,16 +39,8 @@ use std::{ |
32 | 39 | collections::{HashMap, HashSet}, |
33 | 40 | }; |
34 | 41 |
|
35 | | -mod interpreter; |
36 | | -mod setting; |
37 | | -pub mod thread; |
38 | | -mod vm_new; |
39 | | -mod vm_object; |
40 | | -mod vm_ops; |
41 | | - |
42 | 42 | pub use interpreter::Interpreter; |
43 | 43 | pub use setting::PySettings; |
44 | | -pub use thread::ThreadedVirtualMachine; |
45 | 44 |
|
46 | 45 | // Objects are live when they are on stack, or referenced by a name (for now) |
47 | 46 |
|
@@ -719,34 +718,3 @@ impl VirtualMachine { |
719 | 718 | object::generic_setattr(module, attr_name.into_pystr_ref(self), Some(val), self) |
720 | 719 | } |
721 | 720 | } |
722 | | - |
723 | | -#[cfg(feature = "rustpython-compiler")] |
724 | | -impl VirtualMachine { |
725 | | - /// Returns a basic CompileOpts instance with options accurate to the vm. Used |
726 | | - /// as the CompileOpts for `vm.compile()`. |
727 | | - pub fn compile_opts(&self) -> CompileOpts { |
728 | | - CompileOpts { |
729 | | - optimize: self.state.settings.optimize, |
730 | | - } |
731 | | - } |
732 | | - |
733 | | - pub fn compile( |
734 | | - &self, |
735 | | - source: &str, |
736 | | - mode: compile::Mode, |
737 | | - source_path: String, |
738 | | - ) -> Result<PyRef<PyCode>, CompileError> { |
739 | | - self.compile_with_opts(source, mode, source_path, self.compile_opts()) |
740 | | - } |
741 | | - |
742 | | - pub fn compile_with_opts( |
743 | | - &self, |
744 | | - source: &str, |
745 | | - mode: compile::Mode, |
746 | | - source_path: String, |
747 | | - opts: CompileOpts, |
748 | | - ) -> Result<PyRef<PyCode>, CompileError> { |
749 | | - compile::compile(source, mode, source_path, opts) |
750 | | - .map(|code| PyCode::new(self.map_codeobj(code)).into_ref(self)) |
751 | | - } |
752 | | -} |
0 commit comments