Fix repr of foo.with(..) (#6773)

This commit is contained in:
Malo 2025-08-22 17:45:53 +01:00 committed by GitHub
parent 0b0c4cdb5f
commit f7b932261b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -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(),
} }
} }
} }

View File

@ -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
} }

View File

@ -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`)