Remove TypeRef from item opts which implement TypeAscriptionOwner

This commit is contained in:
Ville Penttinen 2019-02-27 14:00:08 +02:00
parent 52054e1140
commit d3ce69aee3
6 changed files with 24 additions and 43 deletions

View file

@ -629,11 +629,7 @@ impl ast::TypeParamsOwner for ConstDef {}
impl ast::AttrsOwner for ConstDef {}
impl ast::DocCommentsOwner for ConstDef {}
impl ast::TypeAscriptionOwner for ConstDef {}
impl ConstDef {
pub fn type_ref(&self) -> Option<&TypeRef> {
super::child_opt(self)
}
}
impl ConstDef {}
// ContinueExpr
#[derive(Debug, PartialEq, Eq, Hash)]
@ -1774,10 +1770,6 @@ impl LetStmt {
super::child_opt(self)
}
pub fn type_ref(&self) -> Option<&TypeRef> {
super::child_opt(self)
}
pub fn initializer(&self) -> Option<&Expr> {
super::child_opt(self)
}
@ -2595,11 +2587,7 @@ impl ast::NameOwner for NamedFieldDef {}
impl ast::AttrsOwner for NamedFieldDef {}
impl ast::DocCommentsOwner for NamedFieldDef {}
impl ast::TypeAscriptionOwner for NamedFieldDef {}
impl NamedFieldDef {
pub fn type_ref(&self) -> Option<&TypeRef> {
super::child_opt(self)
}
}
impl NamedFieldDef {}
// NamedFieldDefList
#[derive(Debug, PartialEq, Eq, Hash)]
@ -2782,10 +2770,6 @@ impl Param {
pub fn pat(&self) -> Option<&Pat> {
super::child_opt(self)
}
pub fn type_ref(&self) -> Option<&TypeRef> {
super::child_opt(self)
}
}
// ParamList
@ -3691,10 +3675,6 @@ impl ToOwned for SelfParam {
impl ast::TypeAscriptionOwner for SelfParam {}
impl SelfParam {
pub fn type_ref(&self) -> Option<&TypeRef> {
super::child_opt(self)
}
pub fn self_kw(&self) -> Option<&SelfKw> {
super::child_opt(self)
}
@ -3826,11 +3806,7 @@ impl ast::TypeParamsOwner for StaticDef {}
impl ast::AttrsOwner for StaticDef {}
impl ast::DocCommentsOwner for StaticDef {}
impl ast::TypeAscriptionOwner for StaticDef {}
impl StaticDef {
pub fn type_ref(&self) -> Option<&TypeRef> {
super::child_opt(self)
}
}
impl StaticDef {}
// Stmt
#[derive(Debug, PartialEq, Eq, Hash)]

View file

@ -271,7 +271,15 @@ Grammar(
]
),
"NamedFieldDefList": (collections: [["fields", "NamedFieldDef"]]),
"NamedFieldDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeAscriptionOwner"], options: ["TypeRef"] ),
"NamedFieldDef": (
traits: [
"VisibilityOwner",
"NameOwner",
"AttrsOwner",
"DocCommentsOwner",
"TypeAscriptionOwner"
]
),
"PosFieldDefList": (collections: [["fields", "PosFieldDef"]]),
"PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
"EnumDef": ( traits: [
@ -301,7 +309,6 @@ Grammar(
"DocCommentsOwner",
"TypeAscriptionOwner",
],
options: ["TypeRef"]
),
"StaticDef": (
traits: [
@ -312,7 +319,6 @@ Grammar(
"DocCommentsOwner",
"TypeAscriptionOwner",
],
options: ["TypeRef"]
),
"TypeAliasDef": (
traits: [
@ -574,7 +580,6 @@ Grammar(
"LetStmt": (
options: [
["pat", "Pat"],
["type_ref", "TypeRef"],
["initializer", "Expr"],
],
traits: [
@ -603,14 +608,14 @@ Grammar(
]
),
"SelfParam": (
options: ["TypeRef", "SelfKw"],
options: ["SelfKw"],
traits: [
"TypeAscriptionOwner",
]
),
"SelfKw": (),
"Param": (
options: [ "Pat", "TypeRef" ],
options: [ "Pat" ],
traits: [
"TypeAscriptionOwner",
]