From 1cfc3c72b59f96d1cef3f2e6e488b645648c36ab Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 3 Mar 2021 18:15:33 +0100 Subject: =?UTF-8?q?Show=20name=20of=20user-defined=20functions=20in=20repr?= =?UTF-8?q?esentation=20=F0=9F=A6=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/eval/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/eval') diff --git a/src/eval/mod.rs b/src/eval/mod.rs index f30ee7a7..17620161 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -401,7 +401,8 @@ impl Eval for ExprClosure { visitor.finish() }; - Value::Func(ValueFunc::new(None, move |ctx, args| { + let name = self.name.as_ref().map(|id| id.to_string()); + Value::Func(ValueFunc::new(name, move |ctx, args| { // Don't leak the scopes from the call site. Instead, we use the // scope of captured variables we collected earlier. let prev = std::mem::take(&mut ctx.scopes); -- cgit v1.2.3