From d40c8ab6ab4f7051a12e5ce9433439f3a5afb99f Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 29 Nov 2024 16:03:08 +0100 Subject: Compile-time `PicoStr` interning (#5491) --- crates/typst-eval/src/markup.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/typst-eval/src') diff --git a/crates/typst-eval/src/markup.rs b/crates/typst-eval/src/markup.rs index 25ea5751..3a5ebe1f 100644 --- a/crates/typst-eval/src/markup.rs +++ b/crates/typst-eval/src/markup.rs @@ -11,6 +11,7 @@ use typst_library::text::{ LinebreakElem, RawContent, RawElem, SmartQuoteElem, SpaceElem, TextElem, }; use typst_syntax::ast::{self, AstNode}; +use typst_utils::PicoStr; use crate::{Eval, Vm}; @@ -204,7 +205,7 @@ impl Eval for ast::Label<'_> { type Output = Value; fn eval(self, _: &mut Vm) -> SourceResult { - Ok(Value::Label(Label::new(self.get()))) + Ok(Value::Label(Label::new(PicoStr::intern(self.get())))) } } @@ -212,7 +213,7 @@ impl Eval for ast::Ref<'_> { type Output = Content; fn eval(self, vm: &mut Vm) -> SourceResult { - let target = Label::new(self.target()); + let target = Label::new(PicoStr::intern(self.target())); let mut elem = RefElem::new(target); if let Some(supplement) = self.supplement() { elem.push_supplement(Smart::Custom(Some(Supplement::Content( -- cgit v1.2.3