From d5aa75bbcf5efb13a82330414e26a4a582453552 Mon Sep 17 00:00:00 2001 From: Ryan Lahfa Date: Sun, 31 Dec 2023 00:00:50 +0100 Subject: feat(tvix/eval): emit warnings with kinds and spans In the past, we had `emit_warning` be no-op and we used `push_warnings` exclusively but as we have consumers of this function, we need it to work somewhat. Change-Id: I78a5ece199a473dec9ef5ea1fae60b36e35137b8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10477 Reviewed-by: tazjin Tested-by: BuildkiteCI Reviewed-by: flokli --- tvix/eval/src/vm/mod.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'tvix') diff --git a/tvix/eval/src/vm/mod.rs b/tvix/eval/src/vm/mod.rs index 92fa0f00e3d3..febf1cb195ce 100644 --- a/tvix/eval/src/vm/mod.rs +++ b/tvix/eval/src/vm/mod.rs @@ -968,13 +968,11 @@ impl<'o> VM<'o> { /// Emit a warning with the given WarningKind and the source span /// of the current instruction. - pub fn emit_warning(&mut self, _kind: WarningKind) { - // TODO: put LightSpan in warning, calculate only *after* eval - // TODO: what to do with the spans? - // self.push_warning(EvalWarning { - // kind, - // span: self.current_span(), - // }); + pub fn emit_warning(&mut self, kind: WarningKind) { + self.push_warning(EvalWarning { + kind, + span: self.get_span(), + }); } /// Interpolate string fragments by popping the specified number of -- cgit 1.4.1