From b69b50feb1a1323188cf1f6da2141c5e8d21999a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 3 Oct 2022 16:08:59 +0300 Subject: refactor(tvix/eval): split observer traits in two There are actually two different types of observers, the ones that observe the compiler (and emitted chunks from different kinds of expressions), and the ones that trace runtime execution. Use of the NoOpObserver is unchanged, it simply implements both traits. Change-Id: I4277b82674c259ec55238a0de3bb1cdf5e21a258 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6852 Tested-by: BuildkiteCI Reviewed-by: grfn --- tvix/eval/src/compiler/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tvix/eval/src/compiler') diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index 6a3d10acf62d..d69566f070d2 100644 --- a/tvix/eval/src/compiler/mod.rs +++ b/tvix/eval/src/compiler/mod.rs @@ -28,7 +28,7 @@ use std::sync::Arc; use crate::chunk::Chunk; use crate::errors::{Error, ErrorKind, EvalResult}; -use crate::observer::Observer; +use crate::observer::CompilerObserver; use crate::opcode::{CodeIdx, Count, JumpOffset, OpCode, UpvalueIdx}; use crate::value::{Closure, Lambda, Thunk, Value}; use crate::warnings::{EvalWarning, WarningKind}; @@ -95,7 +95,7 @@ struct Compiler<'observer> { /// Carry an observer for the compilation process, which is called /// whenever a chunk is emitted. - observer: &'observer mut dyn Observer, + observer: &'observer mut dyn CompilerObserver, } /// Compiler construction @@ -104,7 +104,7 @@ impl<'observer> Compiler<'observer> { location: Option, file: Arc, globals: HashMap<&'static str, Value>, - observer: &'observer mut dyn Observer, + observer: &'observer mut dyn CompilerObserver, ) -> EvalResult { let mut root_dir = match location { Some(dir) => Ok(dir), @@ -1146,7 +1146,7 @@ pub fn compile( location: Option, file: Arc, globals: HashMap<&'static str, Value>, - observer: &mut dyn Observer, + observer: &mut dyn CompilerObserver, ) -> EvalResult { let mut c = Compiler::new(location, file, globals, observer)?; -- cgit 1.4.1