aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast/node_ext.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-20 22:23:50 +0000
committerGitHub <[email protected]>2021-03-20 22:23:50 +0000
commitbe3dc673e2f00eaa7cfbf4727cc69032ed0b6179 (patch)
treed5566d0f3cc77835aab5770fa9f08b0c0d48f1b1 /crates/syntax/src/ast/node_ext.rs
parent104a19853e0d5560a21e6c6a31961ca592be1032 (diff)
parent38048c35d800230d3e5a79041186366dd0ef44ae (diff)
Merge #8125
8125: Don't use an untyped String for ActiveParam tracking r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
-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)?;