fix(tvix/repl): Share globals and sourcemap across evaluations
Now that we can bind (potentially lazy, potentially lambda-containing) values in the REPL and then reference them in subsequent evaluations, it's important that the values to which we construct shared references are shared across those subsequent evaluations - otherwise, we get panics due to unknown source map locations, or dropped weak references to globals. This change assigns both the globals and the source map as fields on the Repl after the first evaluation, and then passes those in (to the EvaluationBuilder) on subsequent evaluations. On the EvaluationBuilder side, there's some panicking introduced - this is intentional, as my intent is for the builder to be configured statically enough that panicking is the best way to report errors here (it's always a bug to misconfigure an Evaluation, and we'd never want to handle it dynamically). Change-Id: I37225697235c22b683ca48a17d30fa8fedd12d1b Reviewed-on: https://cl.tvl.fyi/c/depot/+/11960 Reviewed-by: flokli <flokli@flokli.de> Autosubmit: aspen <root@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
01765c3717
commit
8821746d6c
10 changed files with 221 additions and 60 deletions
|
|
@ -117,7 +117,7 @@ impl TrackedFormal {
|
|||
|
||||
/// The map of globally available functions and other values that
|
||||
/// should implicitly be resolvable in the global scope.
|
||||
pub(crate) type GlobalsMap = HashMap<&'static str, Value>;
|
||||
pub type GlobalsMap = HashMap<&'static str, Value>;
|
||||
|
||||
/// Set of builtins that (if they exist) should be made available in
|
||||
/// the global scope, meaning that they can be accessed not just
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue