diff options
author | Vincent Ambo <mail@tazj.in> | 2021-01-16T13·35+0300 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2021-01-16T13·46+0000 |
commit | da7e99a4ff129ca3b0ca23ed008d8c5ea29a54dd (patch) | |
tree | 3fa2683eb03683796a587cf7433ac4af07cc4cd9 /users/tazjin/rlox/src/interpreter/tests.rs | |
parent | 29335a8b63ba62bd83019eb193baba7c5b656da3 (diff) |
feat(tazjin/rlox): Use variable depth for env lookup r/2114
Finishes the binding implementation from https://craftinginterpreters.com/resolving-and-binding.html Change-Id: I1e2c1f4139d9e77ce0b99e38db26edd4cdb56ad2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2404 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/rlox/src/interpreter/tests.rs')
-rw-r--r-- | users/tazjin/rlox/src/interpreter/tests.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/users/tazjin/rlox/src/interpreter/tests.rs b/users/tazjin/rlox/src/interpreter/tests.rs index 875116593e44..4698583dfc11 100644 --- a/users/tazjin/rlox/src/interpreter/tests.rs +++ b/users/tazjin/rlox/src/interpreter/tests.rs @@ -1,10 +1,13 @@ use super::*; +use crate::resolver; /// Evaluate a code snippet, returning a value. fn parse_eval(code: &str) -> Value { let chars: Vec<char> = code.chars().collect(); let tokens = scanner::scan(&chars).expect("could not scan code"); - let program = parser::parse(tokens).expect("could not parse code"); + let mut program = parser::parse(tokens).expect("could not parse code"); + program = resolver::resolve(program).expect("could not resolve code"); + Interpreter::create() .interpret(&program) .expect("could not eval code") |