From 38048c35d800230d3e5a79041186366dd0ef44ae Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 20 Mar 2021 23:22:09 +0100 Subject: Don't use an untyped String for ActiveParam tracking --- crates/syntax/src/ast/node_ext.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/syntax/src') diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index 01f580a40..42a7b9c2a 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -380,6 +380,15 @@ impl fmt::Display for NameOrNameRef { } } +impl NameOrNameRef { + pub fn text(&self) -> &str { + match self { + NameOrNameRef::Name(name) => name.text(), + NameOrNameRef::NameRef(name_ref) => name_ref.text(), + } + } +} + impl ast::RecordPatField { pub fn for_field_name_ref(field_name: &ast::NameRef) -> Option { let candidate = field_name.syntax().parent().and_then(ast::RecordPatField::cast)?; -- cgit v1.2.3