about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/treewalk/interpreter
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-01-18T00·21+0300
committertazjin <mail@tazj.in>2021-01-18T00·24+0000
commit1ff7a2686c2d7e405e597f9ac8a96189ec161d58 (patch)
tree1e6613d559744b9722329fa927dd78ce670581ca /users/tazjin/rlox/src/treewalk/interpreter
parentd6d3c12efbcec61b3d868bc7d3f861fdb91835a5 (diff)
refactor(tazjin/rlox): Add Interpreter trait for switching impls r/2129
Change-Id: Iae28d64ce879014c5e5d7e145c536c1f16ad307d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2418
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/rlox/src/treewalk/interpreter')
-rw-r--r--users/tazjin/rlox/src/treewalk/interpreter/tests.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/users/tazjin/rlox/src/treewalk/interpreter/tests.rs b/users/tazjin/rlox/src/treewalk/interpreter/tests.rs
index 34b1df34b0b6..2fc6f4fee978 100644
--- a/users/tazjin/rlox/src/treewalk/interpreter/tests.rs
+++ b/users/tazjin/rlox/src/treewalk/interpreter/tests.rs
@@ -2,13 +2,9 @@ use super::*;
 
 /// 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");
-
     Interpreter::create()
-        .interpret(program)
-        .expect("could not eval code")
+        .interpret(code.into())
+        .expect("could not interpret code")
 }
 
 #[test]