@@ -141,8 +141,7 @@ pub fn compile_input(sess: &Session,
141141 dep_graph) ) ;
142142
143143 // Discard MTWT tables that aren't required past lowering to HIR.
144- if !sess. opts . debugging_opts . keep_mtwt_tables &&
145- !sess. opts . debugging_opts . save_analysis {
144+ if !keep_mtwt_tables ( sess) {
146145 syntax:: ext:: mtwt:: clear_tables ( ) ;
147146 }
148147
@@ -179,8 +178,7 @@ pub fn compile_input(sess: &Session,
179178 "early lint checks" ,
180179 || lint:: check_ast_crate ( sess, & expanded_crate) ) ;
181180
182- let opt_crate = if sess. opts . debugging_opts . keep_ast ||
183- sess. opts . debugging_opts . save_analysis {
181+ let opt_crate = if keep_ast ( sess) {
184182 Some ( & expanded_crate)
185183 } else {
186184 drop ( expanded_crate) ;
@@ -249,6 +247,18 @@ pub fn compile_input(sess: &Session,
249247 Ok ( ( ) )
250248}
251249
250+ fn keep_mtwt_tables ( sess : & Session ) -> bool {
251+ sess. opts . debugging_opts . keep_mtwt_tables ||
252+ sess. opts . debugging_opts . save_analysis ||
253+ sess. opts . debugging_opts . save_analysis_csv
254+ }
255+
256+ fn keep_ast ( sess : & Session ) -> bool {
257+ sess. opts . debugging_opts . keep_ast ||
258+ sess. opts . debugging_opts . save_analysis ||
259+ sess. opts . debugging_opts . save_analysis_csv
260+ }
261+
252262/// The name used for source code that doesn't originate in a file
253263/// (e.g. source from stdin or a string)
254264pub fn anon_src ( ) -> String {
0 commit comments