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 {
|
||||
fn repr(&self) -> EcoString {
|
||||
match self.name() {
|
||||
Some(name) => name.into(),
|
||||
None => "(..) => ..".into(),
|
||||
const DEFAULT: &str = "(..) => ..";
|
||||
match &self.repr {
|
||||
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 {
|
||||
/// The name of the plugin function.
|
||||
pub fn name(&self) -> &str {
|
||||
pub fn name(&self) -> &EcoString {
|
||||
&self.name
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#t(f, `f`)
|
||||
#t(rect , `rect`)
|
||||
#t(() => none, `(..) => ..`)
|
||||
#t(f.with(), `(..) => ..`)
|
||||
|
||||
// Types.
|
||||
#t(int, `int`)
|
||||
|
Loading…
x
Reference in New Issue
Block a user