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>
This commit is contained in:
Vincent Ambo 2022-09-18 02:52:23 +03:00 committed by tazjin
parent 5dd5c7e254
commit 0e5baae7ad
5 changed files with 12 additions and 11 deletions

View file

@ -3,7 +3,7 @@
use super::*;
impl Compiler<'_, '_> {
impl Compiler<'_> {
pub(super) fn compile_attr(&mut self, slot: LocalIdx, node: ast::Attr) {
match node {
ast::Attr::Dynamic(dynamic) => {