Add new trait TypeAscriptionOwner
This trait should be implemented for nodes which have an ascribed type, e.g. thing : Type. Such as let, const, static, param, named struct fields.
This commit is contained in:
@@ -31,6 +31,12 @@ pub trait AstToken: AstNode {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait TypeAscriptionOwner: AstNode {
|
||||
fn ascribed_type(&self) -> Option<&TypeRef> {
|
||||
child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait NameOwner: AstNode {
|
||||
fn name(&self) -> Option<&Name> {
|
||||
child_opt(self)
|
||||
|
||||
Reference in New Issue
Block a user