@@ -89,7 +89,7 @@ pub fn compile_input(sess: &Session,
8989 // large chunks of memory alive and we want to free them as soon as
9090 // possible to keep the peak memory usage low
9191 let ( outputs, trans) = {
92- let krate = match phase_1_parse_input ( sess, input) {
92+ let krate = match phase_1_parse_input ( control , sess, input) {
9393 Ok ( krate) => krate,
9494 Err ( mut parse_error) => {
9595 parse_error. emit ( ) ;
@@ -296,9 +296,13 @@ pub struct CompileController<'a> {
296296 pub after_llvm : PhaseController < ' a > ,
297297 pub compilation_done : PhaseController < ' a > ,
298298
299+ // FIXME we probably want to group the below options together and offer a
300+ // better API, rather than this ad-hoc approach.
299301 pub make_glob_map : MakeGlobMap ,
300302 // Whether the compiler should keep the ast beyond parsing.
301303 pub keep_ast : bool ,
304+ // -Zcontinue-parse-after-error
305+ pub continue_parse_after_error : bool ,
302306}
303307
304308impl < ' a > CompileController < ' a > {
@@ -312,6 +316,7 @@ impl<'a> CompileController<'a> {
312316 compilation_done : PhaseController :: basic ( ) ,
313317 make_glob_map : MakeGlobMap :: No ,
314318 keep_ast : false ,
319+ continue_parse_after_error : false ,
315320 }
316321 }
317322}
@@ -484,20 +489,22 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> {
484489 }
485490
486491 fn state_when_compilation_done ( input : & ' a Input ,
487- session : & ' tcx Session ,
488- out_dir : & ' a Option < PathBuf > ,
489- out_file : & ' a Option < PathBuf > )
490- -> Self {
492+ session : & ' tcx Session ,
493+ out_dir : & ' a Option < PathBuf > ,
494+ out_file : & ' a Option < PathBuf > )
495+ -> Self {
491496 CompileState {
492497 out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
493498 ..CompileState :: empty ( input, session, out_dir)
494499 }
495500 }
496501}
497502
498- pub fn phase_1_parse_input < ' a > ( sess : & ' a Session , input : & Input ) -> PResult < ' a , ast:: Crate > {
499- let continue_after_error = sess. opts . debugging_opts . continue_parse_after_error ;
500- sess. diagnostic ( ) . set_continue_after_error ( continue_after_error) ;
503+ pub fn phase_1_parse_input < ' a > ( control : & CompileController ,
504+ sess : & ' a Session ,
505+ input : & Input )
506+ -> PResult < ' a , ast:: Crate > {
507+ sess. diagnostic ( ) . set_continue_after_error ( control. continue_parse_after_error ) ;
501508
502509 let krate = time ( sess. time_passes ( ) , "parsing" , || {
503510 match * input {
0 commit comments