From f9197dcfef11c4c054a460c80ff6023dae6f1f2a Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 9 Feb 2021 22:56:44 +0100 Subject: =?UTF-8?q?Add=20arguments=20value=20=F0=9F=8F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/expr.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/syntax/expr.rs') diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs index f431ba8d..8a11ebc4 100644 --- a/src/syntax/expr.rs +++ b/src/syntax/expr.rs @@ -531,7 +531,7 @@ impl ExprCall { // Function name. self.callee.pretty(p); - let mut write_args = |items: &[Argument]| { + let mut write_args = |items: &[ExprArg]| { if !items.is_empty() { p.push(' '); p.join(items, ", ", |item, p| item.pretty(p)); @@ -542,7 +542,7 @@ impl ExprCall { // This can written as a chain. // // Example: Transforms "#[v][[f]]" => "#[v | f]". - [head @ .., Argument::Pos(Expr::Call(call))] => { + [head @ .., ExprArg::Pos(Expr::Call(call))] => { write_args(head); call.pretty_bracketed(p, true); } @@ -550,7 +550,7 @@ impl ExprCall { // This can be written with a body. // // Example: Transforms "#[v [Hi]]" => "#[v][Hi]". - [head @ .., Argument::Pos(Expr::Template(template))] => { + [head @ .., ExprArg::Pos(Expr::Template(template))] => { write_args(head); p.push(']'); template.pretty(p); @@ -573,7 +573,7 @@ pub struct ExprArgs { /// The source code location. pub span: Span, /// The positional and named arguments. - pub items: Vec, + pub items: Vec, } impl Pretty for ExprArgs { @@ -584,14 +584,14 @@ impl Pretty for ExprArgs { /// An argument to a function call: `12` or `draw: false`. #[derive(Debug, Clone, PartialEq)] -pub enum Argument { - /// A positional arguments. +pub enum ExprArg { + /// A positional argument. Pos(Expr), /// A named argument. Named(Named), } -impl Argument { +impl ExprArg { /// The source code location. pub fn span(&self) -> Span { match self { @@ -601,7 +601,7 @@ impl Argument { } } -impl Pretty for Argument { +impl Pretty for ExprArg { fn pretty(&self, p: &mut Printer) { match self { Self::Pos(expr) => expr.pretty(p), -- cgit v1.2.3