summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/foundations/value.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2025-02-04 10:38:31 +0100
committerGitHub <noreply@github.com>2025-02-04 09:38:31 +0000
commit50ccd7d60f078f3617bfed5c4e8e1fd7d45ec340 (patch)
tree22c12abf76d2b2c20b49b569167ddf60fbe5b348 /crates/typst-library/src/foundations/value.rs
parent5b3593e571826ae44a3aeb0e0f6f09face7291ac (diff)
Scope deprecations (#5798)
Diffstat (limited to 'crates/typst-library/src/foundations/value.rs')
-rw-r--r--crates/typst-library/src/foundations/value.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/typst-library/src/foundations/value.rs b/crates/typst-library/src/foundations/value.rs
index 4fa380b4..854c2486 100644
--- a/crates/typst-library/src/foundations/value.rs
+++ b/crates/typst-library/src/foundations/value.rs
@@ -11,7 +11,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
use typst_syntax::{ast, Span};
use typst_utils::ArcExt;
-use crate::diag::{HintedStrResult, HintedString, StrResult};
+use crate::diag::{DeprecationSink, HintedStrResult, HintedString, StrResult};
use crate::foundations::{
fields, ops, repr, Args, Array, AutoValue, Bytes, CastInfo, Content, Datetime,
Decimal, Dict, Duration, Fold, FromValue, Func, IntoValue, Label, Module,
@@ -155,15 +155,15 @@ impl Value {
}
/// Try to access a field on the value.
- pub fn field(&self, field: &str) -> StrResult<Value> {
+ pub fn field(&self, field: &str, sink: impl DeprecationSink) -> StrResult<Value> {
match self {
Self::Symbol(symbol) => symbol.clone().modified(field).map(Self::Symbol),
Self::Version(version) => version.component(field).map(Self::Int),
Self::Dict(dict) => dict.get(field).cloned(),
Self::Content(content) => content.field_by_name(field),
- Self::Type(ty) => ty.field(field).cloned(),
- Self::Func(func) => func.field(field).cloned(),
- Self::Module(module) => module.field(field).cloned(),
+ Self::Type(ty) => ty.field(field, sink).cloned(),
+ Self::Func(func) => func.field(field, sink).cloned(),
+ Self::Module(module) => module.field(field, sink).cloned(),
_ => fields::field(self, field),
}
}