diff options
| author | Laurenz <laurmaedje@gmail.com> | 2025-02-03 17:04:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-03 16:04:54 +0000 |
| commit | eee903b0f8d5c0dfda3539888d7473c6163841b0 (patch) | |
| tree | d92b2f4565b0153c03cbb63575e2edd4e911e853 /crates/typst-eval/src/access.rs | |
| parent | 12dbb012b19a29612fc863c558901200b4013f5d (diff) | |
Refactor `Scope` (#5797)
Diffstat (limited to 'crates/typst-eval/src/access.rs')
| -rw-r--r-- | crates/typst-eval/src/access.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/typst-eval/src/access.rs b/crates/typst-eval/src/access.rs index 9bcac4d6..22a6b7f3 100644 --- a/crates/typst-eval/src/access.rs +++ b/crates/typst-eval/src/access.rs @@ -30,12 +30,14 @@ impl Access for ast::Ident<'_> { fn access<'a>(self, vm: &'a mut Vm) -> SourceResult<&'a mut Value> { let span = self.span(); if vm.inspected == Some(span) { - if let Ok(value) = vm.scopes.get(&self).cloned() { - vm.trace(value); + if let Ok(binding) = vm.scopes.get(&self) { + vm.trace(binding.read().clone()); } } - let value = vm.scopes.get_mut(&self).at(span)?; - Ok(value) + vm.scopes + .get_mut(&self) + .and_then(|b| b.write().map_err(Into::into)) + .at(span) } } |
