From 59957746e91c1322a8ca6d228bcaa0f31941ee1b Mon Sep 17 00:00:00 2001 From: Marmare314 <49279081+Marmare314@users.noreply.github.com> Date: Wed, 26 Apr 2023 11:32:11 +0200 Subject: Pattern as parameter (#854) --- src/syntax/ast.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/syntax/ast.rs') diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs index 1fa6c89f..53e92949 100644 --- a/src/syntax/ast.rs +++ b/src/syntax/ast.rs @@ -1594,23 +1594,19 @@ node! { #[derive(Debug, Clone, Hash)] pub enum Param { /// A positional parameter: `x`. - Pos(Ident), + Pos(Pattern), /// A named parameter with a default value: `draw: false`. Named(Named), /// An argument sink: `..args`. Sink(Spread), - /// A placeholder: `_`. - Placeholder(Underscore), } impl AstNode for Param { fn from_untyped(node: &SyntaxNode) -> Option { match node.kind() { - SyntaxKind::Ident => node.cast().map(Self::Pos), SyntaxKind::Named => node.cast().map(Self::Named), SyntaxKind::Spread => node.cast().map(Self::Sink), - SyntaxKind::Underscore => node.cast().map(Self::Placeholder), - _ => Option::None, + _ => node.cast().map(Self::Pos), } } @@ -1619,7 +1615,6 @@ impl AstNode for Param { Self::Pos(v) => v.as_untyped(), Self::Named(v) => v.as_untyped(), Self::Sink(v) => v.as_untyped(), - Self::Placeholder(v) => v.as_untyped(), } } } -- cgit v1.2.3