refactor(tazjin/rlox): Call resolver from interpreter

This makes the interpreter API a bit cleaner and allows for tighter
integration between the two parts (e.g. for static globals, which are
unhandled in the resolver right now).

Change-Id: I363714dc2e13cefa7731b54326573e0b871295d6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2407
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2021-01-17 11:59:51 +03:00 committed by tazjin
parent 9ea76fdf1a
commit 06a6aa5dc0
4 changed files with 17 additions and 15 deletions

View file

@ -51,8 +51,7 @@ fn run(lox: &mut interpreter::Interpreter, code: &str) {
let result = scanner::scan(&chars)
.and_then(|tokens| parser::parse(tokens))
.and_then(|program| resolver::resolve(program).map_err(|e| vec![e]))
.and_then(|program| lox.interpret(&program).map_err(|e| vec![e]));
.and_then(|program| lox.interpret(program).map_err(|e| vec![e]));
if let Err(errors) = result {
report_errors(errors);