aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-31 11:43:50 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-31 11:43:50 +0100
commitdec9bde10868b5e459535449476d17a6a0987b3e (patch)
tree91bb5a70b999474e4d8212245fe265e71c3afde4 /crates/ra_syntax/src/ast/generated.rs
parent4666138c910a655deb0e8129b0a1dc5974b49bdf (diff)
parent3f62ab8f510fdac1eeab515c515c437d6dd141e6 (diff)
Merge #1038
1038: Add WherePred to allow predicate access in WhereClause r=matklad a=vipentti Lifetime bounds in where predicates are now also parsed into `TYPE_BOUND_LIST` to allow unified access to bounds. Co-authored-by: Ville Penttinen <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs43
1 files changed, 42 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 9ea423b40..c51b4caa4 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -4810,7 +4810,48 @@ impl ToOwned for WhereClause {
4810} 4810}
4811 4811
4812 4812
4813impl WhereClause {} 4813impl WhereClause {
4814 pub fn predicates(&self) -> impl Iterator<Item = &WherePred> {
4815 super::children(self)
4816 }
4817}
4818
4819// WherePred
4820#[derive(Debug, PartialEq, Eq, Hash)]
4821#[repr(transparent)]
4822pub struct WherePred {
4823 pub(crate) syntax: SyntaxNode,
4824}
4825unsafe impl TransparentNewType for WherePred {
4826 type Repr = rowan::SyntaxNode<RaTypes>;
4827}
4828
4829impl AstNode for WherePred {
4830 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4831 match syntax.kind() {
4832 WHERE_PRED => Some(WherePred::from_repr(syntax.into_repr())),
4833 _ => None,
4834 }
4835 }
4836 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4837}
4838
4839impl ToOwned for WherePred {
4840 type Owned = TreeArc<WherePred>;
4841 fn to_owned(&self) -> TreeArc<WherePred> { TreeArc::cast(self.syntax.to_owned()) }
4842}
4843
4844
4845impl ast::TypeBoundsOwner for WherePred {}
4846impl WherePred {
4847 pub fn type_ref(&self) -> Option<&TypeRef> {
4848 super::child_opt(self)
4849 }
4850
4851 pub fn lifetime(&self) -> Option<&Lifetime> {
4852 super::child_opt(self)
4853 }
4854}
4814 4855
4815// WhileExpr 4856// WhileExpr
4816#[derive(Debug, PartialEq, Eq, Hash)] 4857#[derive(Debug, PartialEq, Eq, Hash)]