Commit graph

3 commits

Author SHA1 Message Date
Vincent Ambo
50baf0bcfc refactor(tvix/eval): move spans module to crate root
This is also useful for error-handling related logic, outside of just
the compiler module.

Change-Id: I5c386e2b4c31cda0a0209b31136ca07f00e39e45
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6869
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2022-10-08 10:58:42 +00:00
Vincent Ambo
0e5baae7ad refactor(tvix/eval): clone the Arc<codemap::File> for the compiler
This disconnects ownership of the `File` reference in a compiler from
the calling scope, which is required for when we implement `import`.

`import` will need to carry an `Rc<RefCell<CodeMap>>` (or maybe, in
the future, Arc) to give us the ability to add new detected code
files at runtime.

Note that the choice of `Arc` over `Rc` here is not ours - it's the
codemap crate's.

Change-Id: I3aeca4ffc167acbd1701846a332d93550b56ba7d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6630
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2022-09-18 21:12:50 +00:00
Vincent Ambo
337d670d0c feat(tvix/eval): introduce ToSpan trait in compiler module
This trait can be used to convert most structures from rnix-parser
into a codemap::Span. It uses a macro to implement the trait for the
various expression types in the rnix AST, as Rust's silly semantic
versioning restriction stops us from doing a blanket implementation.

This will be used in the next commit to clean up the span handling in
the compiler a bit.

Change-Id: I0a437034e5fa203b5a49c6f25c45932a9f3b2bca
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6615
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-09-17 14:11:19 +00:00