@@ -89,7 +89,7 @@ pub fn compile_input(sess: &Session,
89
89
// large chunks of memory alive and we want to free them as soon as
90
90
// possible to keep the peak memory usage low
91
91
let ( outputs, trans) = {
92
- let krate = match phase_1_parse_input ( sess, input) {
92
+ let krate = match phase_1_parse_input ( control , sess, input) {
93
93
Ok ( krate) => krate,
94
94
Err ( mut parse_error) => {
95
95
parse_error. emit ( ) ;
@@ -296,9 +296,13 @@ pub struct CompileController<'a> {
296
296
pub after_llvm : PhaseController < ' a > ,
297
297
pub compilation_done : PhaseController < ' a > ,
298
298
299
+ // FIXME we probably want to group the below options together and offer a
300
+ // better API, rather than this ad-hoc approach.
299
301
pub make_glob_map : MakeGlobMap ,
300
302
// Whether the compiler should keep the ast beyond parsing.
301
303
pub keep_ast : bool ,
304
+ // -Zcontinue-parse-after-error
305
+ pub continue_parse_after_error : bool ,
302
306
}
303
307
304
308
impl < ' a > CompileController < ' a > {
@@ -312,6 +316,7 @@ impl<'a> CompileController<'a> {
312
316
compilation_done : PhaseController :: basic ( ) ,
313
317
make_glob_map : MakeGlobMap :: No ,
314
318
keep_ast : false ,
319
+ continue_parse_after_error : false ,
315
320
}
316
321
}
317
322
}
@@ -484,20 +489,22 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> {
484
489
}
485
490
486
491
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 {
491
496
CompileState {
492
497
out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
493
498
..CompileState :: empty ( input, session, out_dir)
494
499
}
495
500
}
496
501
}
497
502
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 ) ;
501
508
502
509
let krate = time ( sess. time_passes ( ) , "parsing" , || {
503
510
match * input {
0 commit comments