@@ -518,7 +518,8 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
518518 -> CompileController < ' a > {
519519 let mut control = CompileController :: basic ( ) ;
520520
521- control. keep_ast = sess. opts . debugging_opts . keep_ast || save_analysis ( sess) ;
521+ control. keep_ast = sess. opts . debugging_opts . keep_ast ;
522+ control. continue_parse_after_error = sess. opts . debugging_opts . continue_parse_after_error ;
522523
523524 if let Some ( ( ppm, opt_uii) ) = parse_pretty ( sess, matches) {
524525 if ppm. needs_ast_map ( & opt_uii) {
@@ -574,19 +575,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
574575 }
575576
576577 if save_analysis ( sess) {
577- control. after_analysis . callback = box |state| {
578- time ( state. session . time_passes ( ) , "save analysis" , || {
579- save:: process_crate ( state. tcx . unwrap ( ) ,
580- state. expanded_crate . unwrap ( ) ,
581- state. analysis . unwrap ( ) ,
582- state. crate_name . unwrap ( ) ,
583- None ,
584- DumpHandler :: new ( state. out_dir ,
585- state. crate_name . unwrap ( ) ) )
586- } ) ;
587- } ;
588- control. after_analysis . run_callback_on_error = true ;
589- control. make_glob_map = resolve:: MakeGlobMap :: Yes ;
578+ enable_save_analysis ( & mut control) ;
590579 }
591580
592581 if sess. print_fuel_crate . is_some ( ) {
@@ -603,6 +592,23 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
603592 }
604593}
605594
595+ pub fn enable_save_analysis ( control : & mut CompileController ) {
596+ control. keep_ast = true ;
597+ control. after_analysis . callback = box |state| {
598+ time ( state. session . time_passes ( ) , "save analysis" , || {
599+ save:: process_crate ( state. tcx . unwrap ( ) ,
600+ state. expanded_crate . unwrap ( ) ,
601+ state. analysis . unwrap ( ) ,
602+ state. crate_name . unwrap ( ) ,
603+ None ,
604+ DumpHandler :: new ( state. out_dir ,
605+ state. crate_name . unwrap ( ) ) )
606+ } ) ;
607+ } ;
608+ control. after_analysis . run_callback_on_error = true ;
609+ control. make_glob_map = resolve:: MakeGlobMap :: Yes ;
610+ }
611+
606612fn save_analysis ( sess : & Session ) -> bool {
607613 sess. opts . debugging_opts . save_analysis
608614}
@@ -1215,7 +1221,7 @@ pub fn diagnostics_registry() -> errors::registry::Registry {
12151221 Registry :: new ( & all_errors)
12161222}
12171223
1218- fn get_args ( ) -> Vec < String > {
1224+ pub fn get_args ( ) -> Vec < String > {
12191225 env:: args_os ( ) . enumerate ( )
12201226 . map ( |( i, arg) | arg. into_string ( ) . unwrap_or_else ( |arg| {
12211227 early_error ( ErrorOutputType :: default ( ) ,
0 commit comments