aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2018-12-26 20:24:49 +0000
committerFlorian Diebold <[email protected]>2019-01-04 17:28:36 +0000
commitfe6c4115f6c8bb5b5f276bafcbd9cc3fc1d504d1 (patch)
treef3f06509c39c3cbeadd0e82d534834270c8fc395 /crates/ra_syntax/src
parenta0d483011d5f84747fcc5d5fe9c82f4405d24db9 (diff)
Rename ImplItem to ImplBlock
rustc uses the name ImplItem for items in impls, not the impl {} block itself, which could lead to confusion.
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated.rs36
-rw-r--r--crates/ra_syntax/src/grammar.ron6
-rw-r--r--crates/ra_syntax/src/grammar/items.rs2
-rw-r--r--crates/ra_syntax/src/reparsing.rs2
-rw-r--r--crates/ra_syntax/src/syntax_kinds/generated.rs4
6 files changed, 26 insertions, 26 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index 3aaa5edda..7f986d322 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -279,7 +279,7 @@ impl<'a> NameRef<'a> {
279 } 279 }
280} 280}
281 281
282impl<'a> ImplItem<'a> { 282impl<'a> ImplBlock<'a> {
283 pub fn target_type(self) -> Option<TypeRef<'a>> { 283 pub fn target_type(self) -> Option<TypeRef<'a>> {
284 match self.target() { 284 match self.target() {
285 (Some(t), None) | (_, Some(t)) => Some(t), 285 (Some(t), None) | (_, Some(t)) => Some(t),
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index c619fc130..c1c63f555 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1407,42 +1407,42 @@ impl<'a> IfExpr<'a> {
1407 } 1407 }
1408} 1408}
1409 1409
1410// ImplItem 1410// ImplBlock
1411#[derive(Debug, Clone, Copy,)] 1411#[derive(Debug, Clone, Copy,)]
1412pub struct ImplItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1412pub struct ImplBlockNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1413 pub(crate) syntax: SyntaxNode<R>, 1413 pub(crate) syntax: SyntaxNode<R>,
1414} 1414}
1415pub type ImplItem<'a> = ImplItemNode<RefRoot<'a>>; 1415pub type ImplBlock<'a> = ImplBlockNode<RefRoot<'a>>;
1416 1416
1417impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplItemNode<R1>> for ImplItemNode<R2> { 1417impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplBlockNode<R1>> for ImplBlockNode<R2> {
1418 fn eq(&self, other: &ImplItemNode<R1>) -> bool { self.syntax == other.syntax } 1418 fn eq(&self, other: &ImplBlockNode<R1>) -> bool { self.syntax == other.syntax }
1419} 1419}
1420impl<R: TreeRoot<RaTypes>> Eq for ImplItemNode<R> {} 1420impl<R: TreeRoot<RaTypes>> Eq for ImplBlockNode<R> {}
1421impl<R: TreeRoot<RaTypes>> Hash for ImplItemNode<R> { 1421impl<R: TreeRoot<RaTypes>> Hash for ImplBlockNode<R> {
1422 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } 1422 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1423} 1423}
1424 1424
1425impl<'a> AstNode<'a> for ImplItem<'a> { 1425impl<'a> AstNode<'a> for ImplBlock<'a> {
1426 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1426 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1427 match syntax.kind() { 1427 match syntax.kind() {
1428 IMPL_ITEM => Some(ImplItem { syntax }), 1428 IMPL_BLOCK => Some(ImplBlock { syntax }),
1429 _ => None, 1429 _ => None,
1430 } 1430 }
1431 } 1431 }
1432 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 1432 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
1433} 1433}
1434 1434
1435impl<R: TreeRoot<RaTypes>> ImplItemNode<R> { 1435impl<R: TreeRoot<RaTypes>> ImplBlockNode<R> {
1436 pub fn borrowed(&self) -> ImplItem { 1436 pub fn borrowed(&self) -> ImplBlock {
1437 ImplItemNode { syntax: self.syntax.borrowed() } 1437 ImplBlockNode { syntax: self.syntax.borrowed() }
1438 } 1438 }
1439 pub fn owned(&self) -> ImplItemNode { 1439 pub fn owned(&self) -> ImplBlockNode {
1440 ImplItemNode { syntax: self.syntax.owned() } 1440 ImplBlockNode { syntax: self.syntax.owned() }
1441 } 1441 }
1442} 1442}
1443 1443
1444 1444
1445impl<'a> ImplItem<'a> {} 1445impl<'a> ImplBlock<'a> {}
1446 1446
1447// ImplTraitType 1447// ImplTraitType
1448#[derive(Debug, Clone, Copy,)] 1448#[derive(Debug, Clone, Copy,)]
@@ -2157,7 +2157,7 @@ pub enum ModuleItem<'a> {
2157 FnDef(FnDef<'a>), 2157 FnDef(FnDef<'a>),
2158 TraitDef(TraitDef<'a>), 2158 TraitDef(TraitDef<'a>),
2159 TypeDef(TypeDef<'a>), 2159 TypeDef(TypeDef<'a>),
2160 ImplItem(ImplItem<'a>), 2160 ImplBlock(ImplBlock<'a>),
2161 UseItem(UseItem<'a>), 2161 UseItem(UseItem<'a>),
2162 ExternCrateItem(ExternCrateItem<'a>), 2162 ExternCrateItem(ExternCrateItem<'a>),
2163 ConstDef(ConstDef<'a>), 2163 ConstDef(ConstDef<'a>),
@@ -2173,7 +2173,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> {
2173 FN_DEF => Some(ModuleItem::FnDef(FnDef { syntax })), 2173 FN_DEF => Some(ModuleItem::FnDef(FnDef { syntax })),
2174 TRAIT_DEF => Some(ModuleItem::TraitDef(TraitDef { syntax })), 2174 TRAIT_DEF => Some(ModuleItem::TraitDef(TraitDef { syntax })),
2175 TYPE_DEF => Some(ModuleItem::TypeDef(TypeDef { syntax })), 2175 TYPE_DEF => Some(ModuleItem::TypeDef(TypeDef { syntax })),
2176 IMPL_ITEM => Some(ModuleItem::ImplItem(ImplItem { syntax })), 2176 IMPL_BLOCK => Some(ModuleItem::ImplBlock(ImplBlock { syntax })),
2177 USE_ITEM => Some(ModuleItem::UseItem(UseItem { syntax })), 2177 USE_ITEM => Some(ModuleItem::UseItem(UseItem { syntax })),
2178 EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })), 2178 EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })),
2179 CONST_DEF => Some(ModuleItem::ConstDef(ConstDef { syntax })), 2179 CONST_DEF => Some(ModuleItem::ConstDef(ConstDef { syntax })),
@@ -2189,7 +2189,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> {
2189 ModuleItem::FnDef(inner) => inner.syntax(), 2189 ModuleItem::FnDef(inner) => inner.syntax(),
2190 ModuleItem::TraitDef(inner) => inner.syntax(), 2190 ModuleItem::TraitDef(inner) => inner.syntax(),
2191 ModuleItem::TypeDef(inner) => inner.syntax(), 2191 ModuleItem::TypeDef(inner) => inner.syntax(),
2192 ModuleItem::ImplItem(inner) => inner.syntax(), 2192 ModuleItem::ImplBlock(inner) => inner.syntax(),
2193 ModuleItem::UseItem(inner) => inner.syntax(), 2193 ModuleItem::UseItem(inner) => inner.syntax(),
2194 ModuleItem::ExternCrateItem(inner) => inner.syntax(), 2194 ModuleItem::ExternCrateItem(inner) => inner.syntax(),
2195 ModuleItem::ConstDef(inner) => inner.syntax(), 2195 ModuleItem::ConstDef(inner) => inner.syntax(),
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 2abb9da61..9a4a96fac 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -128,7 +128,7 @@ Grammar(
128 "STATIC_DEF", 128 "STATIC_DEF",
129 "CONST_DEF", 129 "CONST_DEF",
130 "TRAIT_DEF", 130 "TRAIT_DEF",
131 "IMPL_ITEM", 131 "IMPL_BLOCK",
132 "TYPE_DEF", 132 "TYPE_DEF",
133 "MACRO_CALL", 133 "MACRO_CALL",
134 "TOKEN_TREE", 134 "TOKEN_TREE",
@@ -307,7 +307,7 @@ Grammar(
307 "AttrsOwner", 307 "AttrsOwner",
308 "DocCommentsOwner" 308 "DocCommentsOwner"
309 ] ), 309 ] ),
310 "ImplItem": (), 310 "ImplBlock": (collections: []),
311 311
312 "ParenType": (options: ["TypeRef"]), 312 "ParenType": (options: ["TypeRef"]),
313 "TupleType": ( collections: [["fields", "TypeRef"]] ), 313 "TupleType": ( collections: [["fields", "TypeRef"]] ),
@@ -348,7 +348,7 @@ Grammar(
348 ], 348 ],
349 ), 349 ),
350 "ModuleItem": ( 350 "ModuleItem": (
351 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplItem", 351 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplBlock",
352 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ] 352 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
353 ), 353 ),
354 354
diff --git a/crates/ra_syntax/src/grammar/items.rs b/crates/ra_syntax/src/grammar/items.rs
index aa5fe0777..b9a00b565 100644
--- a/crates/ra_syntax/src/grammar/items.rs
+++ b/crates/ra_syntax/src/grammar/items.rs
@@ -152,7 +152,7 @@ pub(super) fn maybe_item(p: &mut Parser, flavor: ItemFlavor) -> MaybeItem {
152 // unsafe default impl Foo {} 152 // unsafe default impl Foo {}
153 IMPL_KW => { 153 IMPL_KW => {
154 traits::impl_item(p); 154 traits::impl_item(p);
155 IMPL_ITEM 155 IMPL_BLOCK
156 } 156 }
157 _ => { 157 _ => {
158 return if has_mods { 158 return if has_mods {
diff --git a/crates/ra_syntax/src/reparsing.rs b/crates/ra_syntax/src/reparsing.rs
index 208cae5c8..7ee71a1b6 100644
--- a/crates/ra_syntax/src/reparsing.rs
+++ b/crates/ra_syntax/src/reparsing.rs
@@ -100,7 +100,7 @@ fn find_reparsable_node(
100 ITEM_LIST => { 100 ITEM_LIST => {
101 let parent = node.parent().unwrap(); 101 let parent = node.parent().unwrap();
102 match parent.kind() { 102 match parent.kind() {
103 IMPL_ITEM => grammar::impl_item_list, 103 IMPL_BLOCK => grammar::impl_item_list,
104 TRAIT_DEF => grammar::trait_item_list, 104 TRAIT_DEF => grammar::trait_item_list,
105 MODULE => grammar::mod_item_list, 105 MODULE => grammar::mod_item_list,
106 _ => return None, 106 _ => return None,
diff --git a/crates/ra_syntax/src/syntax_kinds/generated.rs b/crates/ra_syntax/src/syntax_kinds/generated.rs
index 3a869ad34..ef4588d93 100644
--- a/crates/ra_syntax/src/syntax_kinds/generated.rs
+++ b/crates/ra_syntax/src/syntax_kinds/generated.rs
@@ -128,7 +128,7 @@ pub enum SyntaxKind {
128 STATIC_DEF, 128 STATIC_DEF,
129 CONST_DEF, 129 CONST_DEF,
130 TRAIT_DEF, 130 TRAIT_DEF,
131 IMPL_ITEM, 131 IMPL_BLOCK,
132 TYPE_DEF, 132 TYPE_DEF,
133 MACRO_CALL, 133 MACRO_CALL,
134 TOKEN_TREE, 134 TOKEN_TREE,
@@ -389,7 +389,7 @@ impl SyntaxKind {
389 STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" }, 389 STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" },
390 CONST_DEF => &SyntaxInfo { name: "CONST_DEF" }, 390 CONST_DEF => &SyntaxInfo { name: "CONST_DEF" },
391 TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" }, 391 TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" },
392 IMPL_ITEM => &SyntaxInfo { name: "IMPL_ITEM" }, 392 IMPL_BLOCK => &SyntaxInfo { name: "IMPL_BLOCK" },
393 TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" }, 393 TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" },
394 MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" }, 394 MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" },
395 TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" }, 395 TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" },