diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-12T14·07+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-08-26T17·19+0000 |
commit | 7e77972d71967c65e5446e55673869ef2a8d27bb (patch) | |
tree | b7c3f470eb00465ca9b50a4314e88aeff2ad0984 /tvix/eval/src/eval.rs | |
parent | 5512108ca797184560c75bb2f356b699e88ee0ee (diff) |
feat(tvix/eval): add mechanism for emitting warnings from compiler r/4507
These can be used predominantly to emit warnings about things that the compiler can infer, such as deprecated language features. Change-Id: I3649c625459d7f3f95cdf42d5c651d23d66569ec Reviewed-on: https://cl.tvl.fyi/c/depot/+/6174 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/eval.rs')
-rw-r--r-- | tvix/eval/src/eval.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tvix/eval/src/eval.rs b/tvix/eval/src/eval.rs index a12add48b552..31280e4cd197 100644 --- a/tvix/eval/src/eval.rs +++ b/tvix/eval/src/eval.rs @@ -14,8 +14,16 @@ pub fn interpret(code: &str) -> EvalResult<Value> { println!("{}", ast.root().dump()); } - let code = crate::compiler::compile(ast)?; - println!("code: {:?}", code); + let result = crate::compiler::compile(ast)?; + println!("code: {:?}", result.chunk); - crate::vm::run_chunk(code) + for warning in result.warnings { + eprintln!( + "warning: {:?} at {:?}", + warning.kind, + warning.node.text_range().start() + ) + } + + crate::vm::run_chunk(result.chunk) } |