aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-03-20 22:22:09 +0000
committerLukas Wirth <[email protected]>2021-03-20 22:22:09 +0000
commit38048c35d800230d3e5a79041186366dd0ef44ae (patch)
tree5c0e60acc4760288143485ae0e36b173efb43fad /crates/syntax/src/ast
parent5cc8ad0c4afda0c8b6222156b0c725cfb61892c0 (diff)
Don't use an untyped String for ActiveParam tracking
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r--crates/syntax/src/ast/node_ext.rs9
1 files changed, 9 insertions, 0 deletions
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 {
380 } 380 }
381} 381}
382 382
383impl NameOrNameRef {
384 pub fn text(&self) -> &str {
385 match self {
386 NameOrNameRef::Name(name) => name.text(),
387 NameOrNameRef::NameRef(name_ref) => name_ref.text(),
388 }
389 }
390}
391
383impl ast::RecordPatField { 392impl ast::RecordPatField {
384 pub fn for_field_name_ref(field_name: &ast::NameRef) -> Option<ast::RecordPatField> { 393 pub fn for_field_name_ref(field_name: &ast::NameRef) -> Option<ast::RecordPatField> {
385 let candidate = field_name.syntax().parent().and_then(ast::RecordPatField::cast)?; 394 let candidate = field_name.syntax().parent().and_then(ast::RecordPatField::cast)?;