Add initial (flawed) implementation of binding annotations
This commit is contained in:
committed by
Aleksey Kladov
parent
9433a108cf
commit
d48d5b8b6c
@@ -713,6 +713,16 @@ impl FieldPatList {
|
||||
}
|
||||
}
|
||||
|
||||
impl BindPat {
|
||||
pub fn is_mutable(&self) -> bool {
|
||||
self.syntax().children().any(|n| n.kind() == MUT_KW)
|
||||
}
|
||||
|
||||
pub fn is_ref(&self) -> bool {
|
||||
self.syntax().children().any(|n| n.kind() == REF_KW)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_comment_of_items() {
|
||||
let file = SourceFile::parse(
|
||||
|
||||
@@ -180,7 +180,11 @@ impl AstNode for BindPat {
|
||||
|
||||
|
||||
impl ast::NameOwner for BindPat {}
|
||||
impl BindPat {}
|
||||
impl BindPat {
|
||||
pub fn pat(&self) -> Option<&Pat> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
// Block
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
|
||||
@@ -488,7 +488,10 @@ Grammar(
|
||||
),
|
||||
|
||||
"RefPat": ( options: [ "Pat" ]),
|
||||
"BindPat": ( traits: ["NameOwner"] ),
|
||||
"BindPat": (
|
||||
options: [ "Pat" ],
|
||||
traits: ["NameOwner"]
|
||||
),
|
||||
"PlaceholderPat": (),
|
||||
"PathPat": ( options: [ "Path" ] ),
|
||||
"StructPat": ( options: ["FieldPatList", "Path"] ),
|
||||
|
||||
Reference in New Issue
Block a user