Skip to content

Commit

Permalink
Merge #786
Browse files Browse the repository at this point in the history
786: fix(repl): make the REPL respect --no-std r=Marwes a=Etherian

I forgot to handle the REPL case when adding `--no-std` to the interpreter/REPL. This PR rectifies that oversight.

Co-authored-by: Etherian <etherain@gmail.com>
  • Loading branch information
bors[bot] and Etherian authored Oct 1, 2019
2 parents a507ed0 + e797470 commit 1780f5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion repl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ fn run(
let mut runtime = Runtime::new()?;
let prompt = opt.prompt.clone();
let debug_level = opt.debug_level.clone();
runtime.block_on(future::lazy(move || repl::run(color, &prompt, debug_level)))?;
let use_std_lib = !opt.no_std;
runtime.block_on(
future::lazy(move || repl::run(color, &prompt, debug_level, use_std_lib))
)?;
} else if !opt.input.is_empty() {
run_files(compiler, &vm, &opt.input)?;
} else {
Expand Down
3 changes: 2 additions & 1 deletion repl/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,12 @@ pub fn run(
color: Color,
prompt: &str,
debug_level: DebugLevel,
use_std_lib: bool,
) -> impl Future<Item = (), Error = Box<dyn StdError + Send + Sync + 'static>> {
let vm = ::gluon::VmBuilder::new().build();
vm.global_env().set_debug_level(debug_level);

let mut compiler = Compiler::new();
let mut compiler = Compiler::new().use_standard_lib(use_std_lib);
try_future!(
compile_repl(&mut compiler, &vm)
.map_err(|err| err.emit_string(&compiler.code_map()).unwrap()),
Expand Down

0 comments on commit 1780f5b

Please sign in to comment.