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/syntax/expr.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/syntax') diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs index d76ada69..5d10349b 100644 --- a/src/syntax/expr.rs +++ b/src/syntax/expr.rs @@ -27,7 +27,7 @@ pub enum Expr { Binary(ExprBinary), /// An invocation of a function: `f(x, y)`. Call(ExprCall), - /// A closure expression: `(x, y) => { z }`. + /// A closure expression: `(x, y) => z`. Closure(ExprClosure), /// A let expression: `let x = 1`. Let(ExprLet), @@ -414,11 +414,15 @@ impl ExprArg { } } -/// A closure expression: `(x, y) => { z }`. +/// A closure expression: `(x, y) => z`. #[derive(Debug, Clone, PartialEq)] pub struct ExprClosure { /// The source code location. pub span: Span, + /// The name of the closure. + /// + /// This only exists if you use the function syntax sugar: `let f(x) = y`. + pub name: Option, /// The parameter bindings. pub params: Rc>, /// The body of the closure. -- cgit v1.2.3