Make compilation controllable

This commit is contained in:
greg 2016-12-28 16:04:28 -08:00
parent aac3ca40fe
commit 1d8102b9fa
1 changed files with 2 additions and 4 deletions

View File

@ -28,7 +28,7 @@ fn main() {
run_repl(); run_repl();
}, },
[_, ref filename, ..] => { [_, ref filename, ..] => {
run_noninteractive(filename); run_noninteractive(filename, !option_matches.opt_present("i"));
} }
}; };
} }
@ -39,7 +39,7 @@ fn program_options() -> getopts::Options {
options options
} }
fn run_noninteractive(filename: &String) { fn run_noninteractive(filename: &str, compile: bool) {
let mut source_file = File::open(&Path::new(filename)).unwrap(); let mut source_file = File::open(&Path::new(filename)).unwrap();
let mut buffer = String::new(); let mut buffer = String::new();
source_file.read_to_string(&mut buffer).unwrap(); source_file.read_to_string(&mut buffer).unwrap();
@ -54,8 +54,6 @@ fn run_noninteractive(filename: &String) {
Err(err) => { println!("Parse error: {:?}", err); return; } Err(err) => { println!("Parse error: {:?}", err); return; }
}; };
let compile = true;
if compile { if compile {
compilation_sequence(ast, filename); compilation_sequence(ast, filename);
} else { } else {