@@ -129,7 +129,7 @@ fn generate_class_wrapper_for_package(classes: &Vec<&crate::Class>) -> String {
129129}
130130pub fn generate_wrapper ( callbacks : CompilerCallbacks ) -> std:: io:: Result < CompilerCallbacks > {
131131 match callbacks. source . source {
132- Source :: Package { path } => {
132+ Source :: Package { ref path } => {
133133 let mut content = String :: new ( ) ;
134134 let function_wrapper = generate_function_wrapper_for_package ( & callbacks. functions ) ;
135135 content. push_str ( & function_wrapper) ;
@@ -152,9 +152,13 @@ pub fn generate_wrapper(callbacks: CompilerCallbacks) -> std::io::Result<Compile
152152 wrapper_file. write_all ( b"mod metacall_class;\n use metacall_class::*;\n " ) ?;
153153 wrapper_file. write_all ( content. as_bytes ( ) ) ?;
154154
155+ let mut source = Source :: new ( Source :: Package {
156+ path : path. to_path_buf ( ) ,
157+ } ) ;
158+ source. output = callbacks. source . output ;
155159 // construct new callback
156160 Ok ( CompilerCallbacks {
157- source : Source :: new ( Source :: Package { path : path } ) ,
161+ source,
158162 is_parsing : false ,
159163 ..callbacks
160164 } )
@@ -190,10 +194,11 @@ pub fn generate_wrapper(callbacks: CompilerCallbacks) -> std::io::Result<Compile
190194 wrapper_file. write_all ( content. as_bytes ( ) ) ?;
191195 let dst = format ! ( "include!({:?});" , callbacks. source. input_path. clone( ) ) ;
192196 wrapper_file. write_all ( dst. as_bytes ( ) ) ?;
193-
197+ let mut source = Source :: new ( Source :: File { path : source_path } ) ;
198+ source. output = callbacks. source . output ;
194199 // construct new callback
195200 Ok ( CompilerCallbacks {
196- source : Source :: new ( Source :: File { path : source_path } ) ,
201+ source,
197202 is_parsing : false ,
198203 ..callbacks
199204 } )
@@ -217,12 +222,13 @@ pub fn generate_wrapper(callbacks: CompilerCallbacks) -> std::io::Result<Compile
217222 wrapper_file. write_all ( content. as_bytes ( ) ) ?;
218223 let dst = format ! ( "include!({:?});" , source_path. join( "script.rs" ) ) ;
219224 wrapper_file. write_all ( dst. as_bytes ( ) ) ?;
220-
225+ let mut source = Source :: new ( Source :: File {
226+ path : source_path. join ( "wrapped_script.rs" ) ,
227+ } ) ;
228+ source. output = callbacks. source . output ;
221229 // construct new callback
222230 Ok ( CompilerCallbacks {
223- source : Source :: new ( Source :: File {
224- path : source_path. join ( "wrapped_script.rs" ) ,
225- } ) ,
231+ source,
226232 is_parsing : false ,
227233 ..callbacks
228234 } )
0 commit comments