Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
-rw-r--r--crates/syntax/src/ast/node_ext.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
index 5447906206..693bfe330b 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -17,7 +17,7 @@ use crate::{
ted, NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, TokenText, T,
};
-use super::{RangeItem, RangeOp};
+use super::{GenericParam, RangeItem, RangeOp};
impl ast::Lifetime {
pub fn text(&self) -> TokenText<'_> {
@@ -822,6 +822,15 @@ pub enum TypeOrConstParam {
Const(ast::ConstParam),
}
+impl From<TypeOrConstParam> for GenericParam {
+ fn from(value: TypeOrConstParam) -> Self {
+ match value {
+ TypeOrConstParam::Type(it) => GenericParam::TypeParam(it),
+ TypeOrConstParam::Const(it) => GenericParam::ConstParam(it),
+ }
+ }
+}
+
impl TypeOrConstParam {
pub fn name(&self) -> Option<ast::Name> {
match self {