mirror of
https://github.com/typst/typst
synced 2025-08-23 11:14:13 +08:00
Fix repr
of foo.with(..)
(#6773)
This commit is contained in:
parent
0b0c4cdb5f
commit
f7b932261b
@ -424,9 +424,13 @@ impl Debug for Func {
|
|||||||
|
|
||||||
impl repr::Repr for Func {
|
impl repr::Repr for Func {
|
||||||
fn repr(&self) -> EcoString {
|
fn repr(&self) -> EcoString {
|
||||||
match self.name() {
|
const DEFAULT: &str = "(..) => ..";
|
||||||
Some(name) => name.into(),
|
match &self.repr {
|
||||||
None => "(..) => ..".into(),
|
Repr::Native(native) => native.name.into(),
|
||||||
|
Repr::Element(elem) => elem.name().into(),
|
||||||
|
Repr::Closure(closure) => closure.name().unwrap_or(DEFAULT).into(),
|
||||||
|
Repr::Plugin(func) => func.name().clone(),
|
||||||
|
Repr::With(_) => DEFAULT.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ pub struct PluginFunc {
|
|||||||
|
|
||||||
impl PluginFunc {
|
impl PluginFunc {
|
||||||
/// The name of the plugin function.
|
/// The name of the plugin function.
|
||||||
pub fn name(&self) -> &str {
|
pub fn name(&self) -> &EcoString {
|
||||||
&self.name
|
&self.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#t(f, `f`)
|
#t(f, `f`)
|
||||||
#t(rect , `rect`)
|
#t(rect , `rect`)
|
||||||
#t(() => none, `(..) => ..`)
|
#t(() => none, `(..) => ..`)
|
||||||
|
#t(f.with(), `(..) => ..`)
|
||||||
|
|
||||||
// Types.
|
// Types.
|
||||||
#t(int, `int`)
|
#t(int, `int`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user