@@ -50,9 +50,14 @@ fn main() {
5050 }
5151}
5252
53- fn _run_string ( source : & String , source_path : Option < String > ) {
53+ fn _run_string ( source : & str , source_path : Option < String > ) {
5454 let mut vm = VirtualMachine :: new ( ) ;
55- let code_obj = compile:: compile ( & mut vm, & source, compile:: Mode :: Exec , source_path) . unwrap ( ) ;
55+ let code_obj = compile:: compile (
56+ & mut vm,
57+ & source. to_string ( ) ,
58+ compile:: Mode :: Exec ,
59+ source_path,
60+ ) . unwrap ( ) ;
5661 debug ! ( "Code object: {:?}" , code_obj. borrow( ) ) ;
5762 let builtins = vm. get_builtin_scope ( ) ;
5863 let vars = vm. context ( ) . new_scope ( Some ( builtins) ) ; // Keep track of local variables
@@ -74,7 +79,7 @@ fn run_command(source: &mut String) {
7479 _run_string ( source, None )
7580}
7681
77- fn run_script ( script_file : & String ) {
82+ fn run_script ( script_file : & str ) {
7883 debug ! ( "Running file {}" , script_file) ;
7984 // Parse an ast from it:
8085 let filepath = Path :: new ( script_file) ;
@@ -87,8 +92,8 @@ fn run_script(script_file: &String) {
8792 }
8893}
8994
90- fn shell_exec ( vm : & mut VirtualMachine , source : & String , scope : PyObjectRef ) -> bool {
91- match compile:: compile ( vm, source, compile:: Mode :: Single , None ) {
95+ fn shell_exec ( vm : & mut VirtualMachine , source : & str , scope : PyObjectRef ) -> bool {
96+ match compile:: compile ( vm, & source. to_string ( ) , compile:: Mode :: Single , None ) {
9297 Ok ( code) => {
9398 match vm. run_code_obj ( code, scope. clone ( ) ) {
9499 Ok ( _value) => {
0 commit comments