From 1cfc3c72b59f96d1cef3f2e6e488b645648c36ab Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 3 Mar 2021 18:15:33 +0100 Subject: [PATCH] =?UTF-8?q?Show=20name=20of=20user-defined=20functions=20i?= =?UTF-8?q?n=20representation=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 ++- src/parse/mod.rs | 29 +++++++++++++++-------------- src/syntax/expr.rs | 8 ++++++-- tests/ref/repr.png | Bin 8695 -> 10420 bytes tests/typ/repr.typ | 8 ++++++++ 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/eval/mod.rs b/src/eval/mod.rs index f30ee7a7c..176201619 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); diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 298015277..afd851930 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -190,13 +190,13 @@ fn primary(p: &mut Parser) -> Option { // Arrow means this is closure's lone parameter. if p.eat_if(Token::Arrow) { - return expr(p).map(|body| { - Expr::Closure(ExprClosure { - span: ident.span.join(body.span()), - params: Rc::new(vec![ident]), - body: Rc::new(body), - }) - }); + let body = expr(p)?; + return Some(Expr::Closure(ExprClosure { + span: ident.span.join(body.span()), + name: None, + params: Rc::new(vec![ident]), + body: Rc::new(body), + })); } Some(Expr::Ident(ident)) @@ -263,13 +263,13 @@ pub fn parenthesized(p: &mut Parser) -> Option { // Arrow means this is closure's parameter list. if p.eat_if(Token::Arrow) { let params = params(p, items); - return expr(p).map(|body| { - Expr::Closure(ExprClosure { - span: span.join(body.span()), - params: Rc::new(params), - body: Rc::new(body), - }) - }); + let body = expr(p)?; + return Some(Expr::Closure(ExprClosure { + span: span.join(body.span()), + name: None, + params: Rc::new(params), + body: Rc::new(body), + })); } // Find out which kind of collection this is. @@ -509,6 +509,7 @@ fn expr_let(p: &mut Parser) -> Option { let body = init?; init = Some(Expr::Closure(ExprClosure { span: binding.span.join(body.span()), + name: Some(binding.clone()), params: Rc::new(params), body: Rc::new(body), })); diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs index d76ada69e..5d10349b4 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. diff --git a/tests/ref/repr.png b/tests/ref/repr.png index 2e7755d38a48d616e6bd3af8d6557a72a49bf9eb..54a1d24099022d4197f94a5d55e3d15d6c5dd633 100644 GIT binary patch literal 10420 zcmbVycT`i`x^EH!gq|QEN=*(m_DQ2GT)9dI#wNB7`o|yGq+gml8T5bZH7o z=)DL?@BOjQefQjb_PO`nG2U47kC`>r%AE6CU;X{Qu!lNoROC0w0RRA%hPtvY000C7 z0ANzc)eV6Bfci85aN9>i`QDQ^W9yT%&goLuQL{rpHvo$Q=_jJ2 z@!^>FAsO%Nxj&?jk*juFO6NuT)@k z_x|^BL8kZ+{7X>I)zGBVG5n##aP-?J!(+z350#yWPzm&=$9a$fjj}la-t`Vt!k9%I zZIbY-i3xO3g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OmzTX4cso`;#YKr|X2#q0J17?pE z>I|EZsno`vnj*yEF-e&L9BkWpwQ;gB<+E(vmFyG8rVy)MwrV@@GhOw8ryAzJiXd{l z^~No#Y64f82!jy1M8DT-(|7W6dxl3u{FNb`@I*a;H!N`{%t5&!lkN@;s}~Nfop&|o zy8VL+INY9<7A|pF_nv6t;)EgW*Z`baJz%_!s;M+BiLEpr%Z#RPd)A4!9{XDAeDd%D z0fas)F?IYv){A<}dNPkJYA>SsPZfs?AC>*TZ!F#^_r~{}lW7yFhUH%nWd3;3@laV? JsZ;?K_Fsmf9U1@t diff --git a/tests/typ/repr.typ b/tests/typ/repr.typ index 666db4285..6eead75e0 100644 --- a/tests/typ/repr.typ +++ b/tests/typ/repr.typ @@ -48,3 +48,11 @@ --- // Templates. {[*{"H" + "i"} there*]} + +--- +// Functions +#let f(x) = x + +{box} \ +{f} \ +{() => none} \