diff options
78 files changed, 598 insertions, 592 deletions
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index 076df98f2..6815638dc 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs | |||
@@ -93,15 +93,15 @@ impl<N: AstNode> AstEditor<N> { | |||
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | impl AstEditor<ast::NamedFieldList> { | 96 | impl AstEditor<ast::RecordFieldList> { |
97 | pub fn append_field(&mut self, field: &ast::NamedField) { | 97 | pub fn append_field(&mut self, field: &ast::RecordField) { |
98 | self.insert_field(InsertPosition::Last, field) | 98 | self.insert_field(InsertPosition::Last, field) |
99 | } | 99 | } |
100 | 100 | ||
101 | pub fn insert_field( | 101 | pub fn insert_field( |
102 | &mut self, | 102 | &mut self, |
103 | position: InsertPosition<&'_ ast::NamedField>, | 103 | position: InsertPosition<&'_ ast::RecordField>, |
104 | field: &ast::NamedField, | 104 | field: &ast::RecordField, |
105 | ) { | 105 | ) { |
106 | let is_multiline = self.ast().syntax().text().contains_char('\n'); | 106 | let is_multiline = self.ast().syntax().text().contains_char('\n'); |
107 | let ws; | 107 | let ws; |
@@ -245,16 +245,16 @@ pub struct AstBuilder<N: AstNode> { | |||
245 | _phantom: std::marker::PhantomData<N>, | 245 | _phantom: std::marker::PhantomData<N>, |
246 | } | 246 | } |
247 | 247 | ||
248 | impl AstBuilder<ast::NamedField> { | 248 | impl AstBuilder<ast::RecordField> { |
249 | pub fn from_name(name: &Name) -> ast::NamedField { | 249 | pub fn from_name(name: &Name) -> ast::RecordField { |
250 | ast_node_from_file_text(&format!("fn f() {{ S {{ {}: (), }} }}", name)) | 250 | ast_node_from_file_text(&format!("fn f() {{ S {{ {}: (), }} }}", name)) |
251 | } | 251 | } |
252 | 252 | ||
253 | fn from_text(text: &str) -> ast::NamedField { | 253 | fn from_text(text: &str) -> ast::RecordField { |
254 | ast_node_from_file_text(&format!("fn f() {{ S {{ {}, }} }}", text)) | 254 | ast_node_from_file_text(&format!("fn f() {{ S {{ {}, }} }}", text)) |
255 | } | 255 | } |
256 | 256 | ||
257 | pub fn from_pieces(name: &ast::NameRef, expr: Option<&ast::Expr>) -> ast::NamedField { | 257 | pub fn from_pieces(name: &ast::NameRef, expr: Option<&ast::Expr>) -> ast::RecordField { |
258 | match expr { | 258 | match expr { |
259 | Some(expr) => Self::from_text(&format!("{}: {}", name.syntax(), expr.syntax())), | 259 | Some(expr) => Self::from_text(&format!("{}: {}", name.syntax(), expr.syntax())), |
260 | None => Self::from_text(&name.syntax().to_string()), | 260 | None => Self::from_text(&name.syntax().to_string()), |
@@ -336,12 +336,12 @@ impl AstBuilder<ast::TupleStructPat> { | |||
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | impl AstBuilder<ast::StructPat> { | 339 | impl AstBuilder<ast::RecordPat> { |
340 | fn from_text(text: &str) -> ast::StructPat { | 340 | fn from_text(text: &str) -> ast::RecordPat { |
341 | ast_node_from_file_text(&format!("fn f({}: ())", text)) | 341 | ast_node_from_file_text(&format!("fn f({}: ())", text)) |
342 | } | 342 | } |
343 | 343 | ||
344 | pub fn from_pieces(path: &ast::Path, pats: impl Iterator<Item = ast::Pat>) -> ast::StructPat { | 344 | pub fn from_pieces(path: &ast::Path, pats: impl Iterator<Item = ast::Pat>) -> ast::RecordPat { |
345 | let pats_str = pats.map(|p| p.syntax().to_string()).collect::<Vec<_>>().join(", "); | 345 | let pats_str = pats.map(|p| p.syntax().to_string()).collect::<Vec<_>>().join(", "); |
346 | Self::from_text(&format!("{}{{ {} }}", path.syntax(), pats_str)) | 346 | Self::from_text(&format!("{}{{ {} }}", path.syntax(), pats_str)) |
347 | } | 347 | } |
diff --git a/crates/ra_assists/src/change_visibility.rs b/crates/ra_assists/src/change_visibility.rs index d28cdd07b..60c74debc 100644 --- a/crates/ra_assists/src/change_visibility.rs +++ b/crates/ra_assists/src/change_visibility.rs | |||
@@ -38,7 +38,7 @@ fn add_vis(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | |||
38 | (vis_offset(&parent), keyword.text_range()) | 38 | (vis_offset(&parent), keyword.text_range()) |
39 | } else { | 39 | } else { |
40 | let ident = ctx.token_at_offset().find(|leaf| leaf.kind() == IDENT)?; | 40 | let ident = ctx.token_at_offset().find(|leaf| leaf.kind() == IDENT)?; |
41 | let field = ident.parent().ancestors().find_map(ast::NamedFieldDef::cast)?; | 41 | let field = ident.parent().ancestors().find_map(ast::RecordFieldDef::cast)?; |
42 | if field.name()?.syntax().text_range() != ident.text_range() && field.visibility().is_some() | 42 | if field.name()?.syntax().text_range() != ident.text_range() && field.visibility().is_some() |
43 | { | 43 | { |
44 | return None; | 44 | return None; |
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs index ce715a449..cc3879562 100644 --- a/crates/ra_assists/src/fill_match_arms.rs +++ b/crates/ra_assists/src/fill_match_arms.rs | |||
@@ -78,7 +78,7 @@ fn build_pat(var: ast::EnumVariant) -> Option<ast::Pat> { | |||
78 | let pats = field_list | 78 | let pats = field_list |
79 | .fields() | 79 | .fields() |
80 | .map(|f| AstBuilder::<ast::BindPat>::from_name(&f.name().unwrap()).into()); | 80 | .map(|f| AstBuilder::<ast::BindPat>::from_name(&f.name().unwrap()).into()); |
81 | AstBuilder::<ast::StructPat>::from_pieces(path, pats).into() | 81 | AstBuilder::<ast::RecordPat>::from_pieces(path, pats).into() |
82 | } | 82 | } |
83 | ast::StructKind::Unit => AstBuilder::<ast::PathPat>::from_path(path).into(), | 83 | ast::StructKind::Unit => AstBuilder::<ast::PathPat>::from_path(path).into(), |
84 | }; | 84 | }; |
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 89fc1d1a1..66a58efed 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -318,8 +318,8 @@ pub struct StructField { | |||
318 | 318 | ||
319 | #[derive(Debug)] | 319 | #[derive(Debug)] |
320 | pub enum FieldSource { | 320 | pub enum FieldSource { |
321 | Named(ast::NamedFieldDef), | 321 | Named(ast::RecordFieldDef), |
322 | Pos(ast::PosFieldDef), | 322 | Pos(ast::TupleFieldDef), |
323 | } | 323 | } |
324 | 324 | ||
325 | impl StructField { | 325 | impl StructField { |
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs index f6240830f..301109cb8 100644 --- a/crates/ra_hir/src/diagnostics.rs +++ b/crates/ra_hir/src/diagnostics.rs | |||
@@ -79,7 +79,7 @@ impl<'a> DiagnosticSink<'a> { | |||
79 | #[derive(Debug)] | 79 | #[derive(Debug)] |
80 | pub struct NoSuchField { | 80 | pub struct NoSuchField { |
81 | pub file: HirFileId, | 81 | pub file: HirFileId, |
82 | pub field: AstPtr<ast::NamedField>, | 82 | pub field: AstPtr<ast::RecordField>, |
83 | } | 83 | } |
84 | 84 | ||
85 | impl Diagnostic for NoSuchField { | 85 | impl Diagnostic for NoSuchField { |
@@ -118,7 +118,7 @@ impl Diagnostic for UnresolvedModule { | |||
118 | #[derive(Debug)] | 118 | #[derive(Debug)] |
119 | pub struct MissingFields { | 119 | pub struct MissingFields { |
120 | pub file: HirFileId, | 120 | pub file: HirFileId, |
121 | pub field_list: AstPtr<ast::NamedFieldList>, | 121 | pub field_list: AstPtr<ast::RecordFieldList>, |
122 | pub missed_fields: Vec<Name>, | 122 | pub missed_fields: Vec<Name>, |
123 | } | 123 | } |
124 | 124 | ||
@@ -135,11 +135,11 @@ impl Diagnostic for MissingFields { | |||
135 | } | 135 | } |
136 | 136 | ||
137 | impl AstDiagnostic for MissingFields { | 137 | impl AstDiagnostic for MissingFields { |
138 | type AST = ast::NamedFieldList; | 138 | type AST = ast::RecordFieldList; |
139 | 139 | ||
140 | fn ast(&self, db: &impl HirDatabase) -> Self::AST { | 140 | fn ast(&self, db: &impl HirDatabase) -> Self::AST { |
141 | let root = db.parse_or_expand(self.source().file_id).unwrap(); | 141 | let root = db.parse_or_expand(self.source().file_id).unwrap(); |
142 | let node = self.source().ast.to_node(&root); | 142 | let node = self.source().ast.to_node(&root); |
143 | ast::NamedFieldList::cast(node).unwrap() | 143 | ast::RecordFieldList::cast(node).unwrap() |
144 | } | 144 | } |
145 | } | 145 | } |
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 328d635d4..9e8584908 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -60,7 +60,7 @@ pub struct BodySourceMap { | |||
60 | expr_map_back: ArenaMap<ExprId, SyntaxNodePtr>, | 60 | expr_map_back: ArenaMap<ExprId, SyntaxNodePtr>, |
61 | pat_map: FxHashMap<PatPtr, PatId>, | 61 | pat_map: FxHashMap<PatPtr, PatId>, |
62 | pat_map_back: ArenaMap<PatId, PatPtr>, | 62 | pat_map_back: ArenaMap<PatId, PatPtr>, |
63 | field_map: FxHashMap<(ExprId, usize), AstPtr<ast::NamedField>>, | 63 | field_map: FxHashMap<(ExprId, usize), AstPtr<ast::RecordField>>, |
64 | } | 64 | } |
65 | 65 | ||
66 | type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; | 66 | type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; |
@@ -148,7 +148,7 @@ impl BodySourceMap { | |||
148 | self.pat_map.get(&Either::A(AstPtr::new(node))).cloned() | 148 | self.pat_map.get(&Either::A(AstPtr::new(node))).cloned() |
149 | } | 149 | } |
150 | 150 | ||
151 | pub(crate) fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::NamedField> { | 151 | pub(crate) fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::RecordField> { |
152 | self.field_map[&(expr, field)] | 152 | self.field_map[&(expr, field)] |
153 | } | 153 | } |
154 | } | 154 | } |
@@ -210,9 +210,9 @@ pub enum Expr { | |||
210 | Return { | 210 | Return { |
211 | expr: Option<ExprId>, | 211 | expr: Option<ExprId>, |
212 | }, | 212 | }, |
213 | StructLit { | 213 | RecordLit { |
214 | path: Option<Path>, | 214 | path: Option<Path>, |
215 | fields: Vec<StructLitField>, | 215 | fields: Vec<RecordLitField>, |
216 | spread: Option<ExprId>, | 216 | spread: Option<ExprId>, |
217 | }, | 217 | }, |
218 | Field { | 218 | Field { |
@@ -316,7 +316,7 @@ pub struct MatchArm { | |||
316 | } | 316 | } |
317 | 317 | ||
318 | #[derive(Debug, Clone, Eq, PartialEq)] | 318 | #[derive(Debug, Clone, Eq, PartialEq)] |
319 | pub struct StructLitField { | 319 | pub struct RecordLitField { |
320 | pub name: Name, | 320 | pub name: Name, |
321 | pub expr: ExprId, | 321 | pub expr: ExprId, |
322 | } | 322 | } |
@@ -388,7 +388,7 @@ impl Expr { | |||
388 | f(*expr); | 388 | f(*expr); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | Expr::StructLit { fields, spread, .. } => { | 391 | Expr::RecordLit { fields, spread, .. } => { |
392 | for field in fields { | 392 | for field in fields { |
393 | f(field.expr); | 393 | f(field.expr); |
394 | } | 394 | } |
@@ -474,7 +474,7 @@ impl BindingAnnotation { | |||
474 | } | 474 | } |
475 | 475 | ||
476 | #[derive(Debug, Clone, Eq, PartialEq)] | 476 | #[derive(Debug, Clone, Eq, PartialEq)] |
477 | pub struct FieldPat { | 477 | pub struct RecordFieldPat { |
478 | pub(crate) name: Name, | 478 | pub(crate) name: Name, |
479 | pub(crate) pat: PatId, | 479 | pub(crate) pat: PatId, |
480 | } | 480 | } |
@@ -487,7 +487,7 @@ pub enum Pat { | |||
487 | Tuple(Vec<PatId>), | 487 | Tuple(Vec<PatId>), |
488 | Struct { | 488 | Struct { |
489 | path: Option<Path>, | 489 | path: Option<Path>, |
490 | args: Vec<FieldPat>, | 490 | args: Vec<RecordFieldPat>, |
491 | // FIXME: 'ellipsis' option | 491 | // FIXME: 'ellipsis' option |
492 | }, | 492 | }, |
493 | Range { | 493 | Range { |
@@ -746,14 +746,14 @@ where | |||
746 | let expr = e.expr().map(|e| self.collect_expr(e)); | 746 | let expr = e.expr().map(|e| self.collect_expr(e)); |
747 | self.alloc_expr(Expr::Return { expr }, syntax_ptr) | 747 | self.alloc_expr(Expr::Return { expr }, syntax_ptr) |
748 | } | 748 | } |
749 | ast::Expr::StructLit(e) => { | 749 | ast::Expr::RecordLit(e) => { |
750 | let path = e.path().and_then(Path::from_ast); | 750 | let path = e.path().and_then(Path::from_ast); |
751 | let mut field_ptrs = Vec::new(); | 751 | let mut field_ptrs = Vec::new(); |
752 | let struct_lit = if let Some(nfl) = e.named_field_list() { | 752 | let record_lit = if let Some(nfl) = e.record_field_list() { |
753 | let fields = nfl | 753 | let fields = nfl |
754 | .fields() | 754 | .fields() |
755 | .inspect(|field| field_ptrs.push(AstPtr::new(field))) | 755 | .inspect(|field| field_ptrs.push(AstPtr::new(field))) |
756 | .map(|field| StructLitField { | 756 | .map(|field| RecordLitField { |
757 | name: field | 757 | name: field |
758 | .name_ref() | 758 | .name_ref() |
759 | .map(|nr| nr.as_name()) | 759 | .map(|nr| nr.as_name()) |
@@ -776,12 +776,12 @@ where | |||
776 | }) | 776 | }) |
777 | .collect(); | 777 | .collect(); |
778 | let spread = nfl.spread().map(|s| self.collect_expr(s)); | 778 | let spread = nfl.spread().map(|s| self.collect_expr(s)); |
779 | Expr::StructLit { path, fields, spread } | 779 | Expr::RecordLit { path, fields, spread } |
780 | } else { | 780 | } else { |
781 | Expr::StructLit { path, fields: Vec::new(), spread: None } | 781 | Expr::RecordLit { path, fields: Vec::new(), spread: None } |
782 | }; | 782 | }; |
783 | 783 | ||
784 | let res = self.alloc_expr(struct_lit, syntax_ptr); | 784 | let res = self.alloc_expr(record_lit, syntax_ptr); |
785 | for (i, ptr) in field_ptrs.into_iter().enumerate() { | 785 | for (i, ptr) in field_ptrs.into_iter().enumerate() { |
786 | self.source_map.field_map.insert((res, i), ptr); | 786 | self.source_map.field_map.insert((res, i), ptr); |
787 | } | 787 | } |
@@ -994,25 +994,25 @@ where | |||
994 | Pat::Tuple(args) | 994 | Pat::Tuple(args) |
995 | } | 995 | } |
996 | ast::Pat::PlaceholderPat(_) => Pat::Wild, | 996 | ast::Pat::PlaceholderPat(_) => Pat::Wild, |
997 | ast::Pat::StructPat(p) => { | 997 | ast::Pat::RecordPat(p) => { |
998 | let path = p.path().and_then(Path::from_ast); | 998 | let path = p.path().and_then(Path::from_ast); |
999 | let field_pat_list = | 999 | let record_field_pat_list = |
1000 | p.field_pat_list().expect("every struct should have a field list"); | 1000 | p.record_field_pat_list().expect("every struct should have a field list"); |
1001 | let mut fields: Vec<_> = field_pat_list | 1001 | let mut fields: Vec<_> = record_field_pat_list |
1002 | .bind_pats() | 1002 | .bind_pats() |
1003 | .filter_map(|bind_pat| { | 1003 | .filter_map(|bind_pat| { |
1004 | let ast_pat = | 1004 | let ast_pat = |
1005 | ast::Pat::cast(bind_pat.syntax().clone()).expect("bind pat is a pat"); | 1005 | ast::Pat::cast(bind_pat.syntax().clone()).expect("bind pat is a pat"); |
1006 | let pat = self.collect_pat(ast_pat); | 1006 | let pat = self.collect_pat(ast_pat); |
1007 | let name = bind_pat.name()?.as_name(); | 1007 | let name = bind_pat.name()?.as_name(); |
1008 | Some(FieldPat { name, pat }) | 1008 | Some(RecordFieldPat { name, pat }) |
1009 | }) | 1009 | }) |
1010 | .collect(); | 1010 | .collect(); |
1011 | let iter = field_pat_list.field_pats().filter_map(|f| { | 1011 | let iter = record_field_pat_list.record_field_pats().filter_map(|f| { |
1012 | let ast_pat = f.pat()?; | 1012 | let ast_pat = f.pat()?; |
1013 | let pat = self.collect_pat(ast_pat); | 1013 | let pat = self.collect_pat(ast_pat); |
1014 | let name = f.name()?.as_name(); | 1014 | let name = f.name()?.as_name(); |
1015 | Some(FieldPat { name, pat }) | 1015 | Some(RecordFieldPat { name, pat }) |
1016 | }); | 1016 | }); |
1017 | fields.extend(iter); | 1017 | fields.extend(iter); |
1018 | 1018 | ||
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 82a06ca25..62f7d41f5 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs | |||
@@ -1,9 +1,9 @@ | |||
1 | use rustc_hash::FxHashSet; | 1 | use rustc_hash::FxHashSet; |
2 | use std::sync::Arc; | 2 | use std::sync::Arc; |
3 | 3 | ||
4 | use ra_syntax::ast::{AstNode, StructLit}; | 4 | use ra_syntax::ast::{AstNode, RecordLit}; |
5 | 5 | ||
6 | use super::{Expr, ExprId, StructLitField}; | 6 | use super::{Expr, ExprId, RecordLitField}; |
7 | use crate::{ | 7 | use crate::{ |
8 | adt::AdtDef, | 8 | adt::AdtDef, |
9 | diagnostics::{DiagnosticSink, MissingFields}, | 9 | diagnostics::{DiagnosticSink, MissingFields}, |
@@ -30,17 +30,17 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
30 | pub(crate) fn validate_body(&mut self, db: &impl HirDatabase) { | 30 | pub(crate) fn validate_body(&mut self, db: &impl HirDatabase) { |
31 | let body = self.func.body(db); | 31 | let body = self.func.body(db); |
32 | for e in body.exprs() { | 32 | for e in body.exprs() { |
33 | if let (id, Expr::StructLit { path, fields, spread }) = e { | 33 | if let (id, Expr::RecordLit { path, fields, spread }) = e { |
34 | self.validate_struct_literal(id, path, fields, *spread, db); | 34 | self.validate_record_literal(id, path, fields, *spread, db); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | fn validate_struct_literal( | 39 | fn validate_record_literal( |
40 | &mut self, | 40 | &mut self, |
41 | id: ExprId, | 41 | id: ExprId, |
42 | _path: &Option<Path>, | 42 | _path: &Option<Path>, |
43 | fields: &[StructLitField], | 43 | fields: &[RecordLitField], |
44 | spread: Option<ExprId>, | 44 | spread: Option<ExprId>, |
45 | db: &impl HirDatabase, | 45 | db: &impl HirDatabase, |
46 | ) { | 46 | ) { |
@@ -76,8 +76,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
76 | if let Some(field_list_node) = source_map | 76 | if let Some(field_list_node) = source_map |
77 | .expr_syntax(id) | 77 | .expr_syntax(id) |
78 | .map(|ptr| ptr.to_node(source_file.syntax())) | 78 | .map(|ptr| ptr.to_node(source_file.syntax())) |
79 | .and_then(StructLit::cast) | 79 | .and_then(RecordLit::cast) |
80 | .and_then(|lit| lit.named_field_list()) | 80 | .and_then(|lit| lit.record_field_list()) |
81 | { | 81 | { |
82 | let field_list_ptr = AstPtr::new(&field_list_node); | 82 | let field_list_ptr = AstPtr::new(&field_list_node); |
83 | self.sink.push(MissingFields { | 83 | self.sink.push(MissingFields { |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index e86716d74..56ff7da3a 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -278,13 +278,13 @@ impl SourceAnalyzer { | |||
278 | self.infer.as_ref()?.field_resolution(expr_id) | 278 | self.infer.as_ref()?.field_resolution(expr_id) |
279 | } | 279 | } |
280 | 280 | ||
281 | pub fn resolve_struct_literal(&self, struct_lit: &ast::StructLit) -> Option<crate::VariantDef> { | 281 | pub fn resolve_record_literal(&self, record_lit: &ast::RecordLit) -> Option<crate::VariantDef> { |
282 | let expr_id = self.body_source_map.as_ref()?.node_expr(&struct_lit.clone().into())?; | 282 | let expr_id = self.body_source_map.as_ref()?.node_expr(&record_lit.clone().into())?; |
283 | self.infer.as_ref()?.variant_resolution_for_expr(expr_id) | 283 | self.infer.as_ref()?.variant_resolution_for_expr(expr_id) |
284 | } | 284 | } |
285 | 285 | ||
286 | pub fn resolve_struct_pattern(&self, struct_pat: &ast::StructPat) -> Option<crate::VariantDef> { | 286 | pub fn resolve_record_pattern(&self, record_pat: &ast::RecordPat) -> Option<crate::VariantDef> { |
287 | let pat_id = self.body_source_map.as_ref()?.node_pat(&struct_pat.clone().into())?; | 287 | let pat_id = self.body_source_map.as_ref()?.node_pat(&record_pat.clone().into())?; |
288 | self.infer.as_ref()?.variant_resolution_for_pat(pat_id) | 288 | self.infer.as_ref()?.variant_resolution_for_pat(pat_id) |
289 | } | 289 | } |
290 | 290 | ||
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index cca59538a..b33de5687 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -37,8 +37,8 @@ use crate::{ | |||
37 | code_model::{ModuleDef::Trait, TypeAlias}, | 37 | code_model::{ModuleDef::Trait, TypeAlias}, |
38 | diagnostics::DiagnosticSink, | 38 | diagnostics::DiagnosticSink, |
39 | expr::{ | 39 | expr::{ |
40 | self, Array, BinaryOp, BindingAnnotation, Body, Expr, ExprId, FieldPat, Literal, Pat, | 40 | self, Array, BinaryOp, BindingAnnotation, Body, Expr, ExprId, Literal, Pat, PatId, |
41 | PatId, Statement, UnaryOp, | 41 | RecordFieldPat, Statement, UnaryOp, |
42 | }, | 42 | }, |
43 | generics::{GenericParams, HasGenericParams}, | 43 | generics::{GenericParams, HasGenericParams}, |
44 | name, | 44 | name, |
@@ -705,10 +705,10 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
705 | ty | 705 | ty |
706 | } | 706 | } |
707 | 707 | ||
708 | fn infer_struct_pat( | 708 | fn infer_record_pat( |
709 | &mut self, | 709 | &mut self, |
710 | path: Option<&Path>, | 710 | path: Option<&Path>, |
711 | subpats: &[FieldPat], | 711 | subpats: &[RecordFieldPat], |
712 | expected: &Ty, | 712 | expected: &Ty, |
713 | default_bm: BindingMode, | 713 | default_bm: BindingMode, |
714 | id: PatId, | 714 | id: PatId, |
@@ -800,7 +800,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
800 | self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm) | 800 | self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm) |
801 | } | 801 | } |
802 | Pat::Struct { path: ref p, args: ref fields } => { | 802 | Pat::Struct { path: ref p, args: ref fields } => { |
803 | self.infer_struct_pat(p.as_ref(), fields, expected, default_bm, pat) | 803 | self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat) |
804 | } | 804 | } |
805 | Pat::Path(path) => { | 805 | Pat::Path(path) => { |
806 | // FIXME use correct resolver for the surrounding expression | 806 | // FIXME use correct resolver for the surrounding expression |
@@ -1103,7 +1103,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
1103 | } | 1103 | } |
1104 | Ty::simple(TypeCtor::Never) | 1104 | Ty::simple(TypeCtor::Never) |
1105 | } | 1105 | } |
1106 | Expr::StructLit { path, fields, spread } => { | 1106 | Expr::RecordLit { path, fields, spread } => { |
1107 | let (ty, def_id) = self.resolve_variant(path.as_ref()); | 1107 | let (ty, def_id) = self.resolve_variant(path.as_ref()); |
1108 | if let Some(variant) = def_id { | 1108 | if let Some(variant) = def_id { |
1109 | self.write_variant_resolution(tgt_expr.into(), variant); | 1109 | self.write_variant_resolution(tgt_expr.into(), variant); |
diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs index a6b68be75..a4f080adc 100644 --- a/crates/ra_ide_api/src/completion.rs +++ b/crates/ra_ide_api/src/completion.rs | |||
@@ -3,8 +3,8 @@ mod completion_context; | |||
3 | mod presentation; | 3 | mod presentation; |
4 | 4 | ||
5 | mod complete_dot; | 5 | mod complete_dot; |
6 | mod complete_struct_literal; | 6 | mod complete_record_literal; |
7 | mod complete_struct_pattern; | 7 | mod complete_record_pattern; |
8 | mod complete_pattern; | 8 | mod complete_pattern; |
9 | mod complete_fn_param; | 9 | mod complete_fn_param; |
10 | mod complete_keyword; | 10 | mod complete_keyword; |
@@ -65,8 +65,8 @@ pub(crate) fn completions(db: &db::RootDatabase, position: FilePosition) -> Opti | |||
65 | complete_path::complete_path(&mut acc, &ctx); | 65 | complete_path::complete_path(&mut acc, &ctx); |
66 | complete_scope::complete_scope(&mut acc, &ctx); | 66 | complete_scope::complete_scope(&mut acc, &ctx); |
67 | complete_dot::complete_dot(&mut acc, &ctx); | 67 | complete_dot::complete_dot(&mut acc, &ctx); |
68 | complete_struct_literal::complete_struct_literal(&mut acc, &ctx); | 68 | complete_record_literal::complete_record_literal(&mut acc, &ctx); |
69 | complete_struct_pattern::complete_struct_pattern(&mut acc, &ctx); | 69 | complete_record_pattern::complete_record_pattern(&mut acc, &ctx); |
70 | complete_pattern::complete_pattern(&mut acc, &ctx); | 70 | complete_pattern::complete_pattern(&mut acc, &ctx); |
71 | complete_postfix::complete_postfix(&mut acc, &ctx); | 71 | complete_postfix::complete_postfix(&mut acc, &ctx); |
72 | Some(acc) | 72 | Some(acc) |
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index d43ff2eec..27256f879 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs | |||
@@ -45,7 +45,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) | |||
45 | // FIXME unions | 45 | // FIXME unions |
46 | TypeCtor::Tuple { .. } => { | 46 | TypeCtor::Tuple { .. } => { |
47 | for (i, ty) in a_ty.parameters.iter().enumerate() { | 47 | for (i, ty) in a_ty.parameters.iter().enumerate() { |
48 | acc.add_pos_field(ctx, i, ty); | 48 | acc.add_tuple_field(ctx, i, ty); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | _ => {} | 51 | _ => {} |
diff --git a/crates/ra_ide_api/src/completion/complete_struct_literal.rs b/crates/ra_ide_api/src/completion/complete_record_literal.rs index 6aa41f498..6b929a8ac 100644 --- a/crates/ra_ide_api/src/completion/complete_struct_literal.rs +++ b/crates/ra_ide_api/src/completion/complete_record_literal.rs | |||
@@ -3,11 +3,11 @@ use hir::Substs; | |||
3 | use crate::completion::{CompletionContext, Completions}; | 3 | use crate::completion::{CompletionContext, Completions}; |
4 | 4 | ||
5 | /// Complete fields in fields literals. | 5 | /// Complete fields in fields literals. |
6 | pub(super) fn complete_struct_literal(acc: &mut Completions, ctx: &CompletionContext) { | 6 | pub(super) fn complete_record_literal(acc: &mut Completions, ctx: &CompletionContext) { |
7 | let (ty, variant) = match ctx.struct_lit_syntax.as_ref().and_then(|it| { | 7 | let (ty, variant) = match ctx.record_lit_syntax.as_ref().and_then(|it| { |
8 | Some(( | 8 | Some(( |
9 | ctx.analyzer.type_of(ctx.db, &it.clone().into())?, | 9 | ctx.analyzer.type_of(ctx.db, &it.clone().into())?, |
10 | ctx.analyzer.resolve_struct_literal(it)?, | 10 | ctx.analyzer.resolve_record_literal(it)?, |
11 | )) | 11 | )) |
12 | }) { | 12 | }) { |
13 | Some(it) => it, | 13 | Some(it) => it, |
@@ -30,7 +30,7 @@ mod tests { | |||
30 | } | 30 | } |
31 | 31 | ||
32 | #[test] | 32 | #[test] |
33 | fn test_struct_literal_field() { | 33 | fn test_record_literal_field() { |
34 | let completions = complete( | 34 | let completions = complete( |
35 | r" | 35 | r" |
36 | struct A { the_field: u32 } | 36 | struct A { the_field: u32 } |
@@ -54,7 +54,7 @@ mod tests { | |||
54 | } | 54 | } |
55 | 55 | ||
56 | #[test] | 56 | #[test] |
57 | fn test_struct_literal_enum_variant() { | 57 | fn test_record_literal_enum_variant() { |
58 | let completions = complete( | 58 | let completions = complete( |
59 | r" | 59 | r" |
60 | enum E { | 60 | enum E { |
@@ -80,7 +80,7 @@ mod tests { | |||
80 | } | 80 | } |
81 | 81 | ||
82 | #[test] | 82 | #[test] |
83 | fn test_struct_literal_two_structs() { | 83 | fn test_record_literal_two_structs() { |
84 | let completions = complete( | 84 | let completions = complete( |
85 | r" | 85 | r" |
86 | struct A { a: u32 } | 86 | struct A { a: u32 } |
@@ -106,7 +106,7 @@ mod tests { | |||
106 | } | 106 | } |
107 | 107 | ||
108 | #[test] | 108 | #[test] |
109 | fn test_struct_literal_generic_struct() { | 109 | fn test_record_literal_generic_struct() { |
110 | let completions = complete( | 110 | let completions = complete( |
111 | r" | 111 | r" |
112 | struct A<T> { a: T } | 112 | struct A<T> { a: T } |
diff --git a/crates/ra_ide_api/src/completion/complete_struct_pattern.rs b/crates/ra_ide_api/src/completion/complete_record_pattern.rs index d0dde5930..8c8b47ea4 100644 --- a/crates/ra_ide_api/src/completion/complete_struct_pattern.rs +++ b/crates/ra_ide_api/src/completion/complete_record_pattern.rs | |||
@@ -2,11 +2,11 @@ use hir::Substs; | |||
2 | 2 | ||
3 | use crate::completion::{CompletionContext, Completions}; | 3 | use crate::completion::{CompletionContext, Completions}; |
4 | 4 | ||
5 | pub(super) fn complete_struct_pattern(acc: &mut Completions, ctx: &CompletionContext) { | 5 | pub(super) fn complete_record_pattern(acc: &mut Completions, ctx: &CompletionContext) { |
6 | let (ty, variant) = match ctx.struct_lit_pat.as_ref().and_then(|it| { | 6 | let (ty, variant) = match ctx.record_lit_pat.as_ref().and_then(|it| { |
7 | Some(( | 7 | Some(( |
8 | ctx.analyzer.type_of_pat(ctx.db, &it.clone().into())?, | 8 | ctx.analyzer.type_of_pat(ctx.db, &it.clone().into())?, |
9 | ctx.analyzer.resolve_struct_pattern(it)?, | 9 | ctx.analyzer.resolve_record_pattern(it)?, |
10 | )) | 10 | )) |
11 | }) { | 11 | }) { |
12 | Some(it) => it, | 12 | Some(it) => it, |
@@ -29,7 +29,7 @@ mod tests { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | #[test] | 31 | #[test] |
32 | fn test_struct_pattern_field() { | 32 | fn test_record_pattern_field() { |
33 | let completions = complete( | 33 | let completions = complete( |
34 | r" | 34 | r" |
35 | struct S { foo: u32 } | 35 | struct S { foo: u32 } |
@@ -56,7 +56,7 @@ mod tests { | |||
56 | } | 56 | } |
57 | 57 | ||
58 | #[test] | 58 | #[test] |
59 | fn test_struct_pattern_enum_variant() { | 59 | fn test_record_pattern_enum_variant() { |
60 | let completions = complete( | 60 | let completions = complete( |
61 | r" | 61 | r" |
62 | enum E { | 62 | enum E { |
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs index dfaa9ce69..7139947b3 100644 --- a/crates/ra_ide_api/src/completion/completion_context.rs +++ b/crates/ra_ide_api/src/completion/completion_context.rs | |||
@@ -20,8 +20,8 @@ pub(crate) struct CompletionContext<'a> { | |||
20 | pub(super) module: Option<hir::Module>, | 20 | pub(super) module: Option<hir::Module>, |
21 | pub(super) function_syntax: Option<ast::FnDef>, | 21 | pub(super) function_syntax: Option<ast::FnDef>, |
22 | pub(super) use_item_syntax: Option<ast::UseItem>, | 22 | pub(super) use_item_syntax: Option<ast::UseItem>, |
23 | pub(super) struct_lit_syntax: Option<ast::StructLit>, | 23 | pub(super) record_lit_syntax: Option<ast::RecordLit>, |
24 | pub(super) struct_lit_pat: Option<ast::StructPat>, | 24 | pub(super) record_lit_pat: Option<ast::RecordPat>, |
25 | pub(super) is_param: bool, | 25 | pub(super) is_param: bool, |
26 | /// If a name-binding or reference to a const in a pattern. | 26 | /// If a name-binding or reference to a const in a pattern. |
27 | /// Irrefutable patterns (like let) are excluded. | 27 | /// Irrefutable patterns (like let) are excluded. |
@@ -60,8 +60,8 @@ impl<'a> CompletionContext<'a> { | |||
60 | module, | 60 | module, |
61 | function_syntax: None, | 61 | function_syntax: None, |
62 | use_item_syntax: None, | 62 | use_item_syntax: None, |
63 | struct_lit_syntax: None, | 63 | record_lit_syntax: None, |
64 | struct_lit_pat: None, | 64 | record_lit_pat: None, |
65 | is_param: false, | 65 | is_param: false, |
66 | is_pat_binding: false, | 66 | is_pat_binding: false, |
67 | is_trivial_path: false, | 67 | is_trivial_path: false, |
@@ -120,8 +120,8 @@ impl<'a> CompletionContext<'a> { | |||
120 | self.is_param = true; | 120 | self.is_param = true; |
121 | return; | 121 | return; |
122 | } | 122 | } |
123 | if name.syntax().ancestors().find_map(ast::FieldPatList::cast).is_some() { | 123 | if name.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { |
124 | self.struct_lit_pat = | 124 | self.record_lit_pat = |
125 | find_node_at_offset(original_parse.tree().syntax(), self.offset); | 125 | find_node_at_offset(original_parse.tree().syntax(), self.offset); |
126 | } | 126 | } |
127 | } | 127 | } |
@@ -129,8 +129,8 @@ impl<'a> CompletionContext<'a> { | |||
129 | 129 | ||
130 | fn classify_name_ref(&mut self, original_file: SourceFile, name_ref: ast::NameRef) { | 130 | fn classify_name_ref(&mut self, original_file: SourceFile, name_ref: ast::NameRef) { |
131 | let name_range = name_ref.syntax().text_range(); | 131 | let name_range = name_ref.syntax().text_range(); |
132 | if name_ref.syntax().parent().and_then(ast::NamedField::cast).is_some() { | 132 | if name_ref.syntax().parent().and_then(ast::RecordField::cast).is_some() { |
133 | self.struct_lit_syntax = find_node_at_offset(original_file.syntax(), self.offset); | 133 | self.record_lit_syntax = find_node_at_offset(original_file.syntax(), self.offset); |
134 | } | 134 | } |
135 | 135 | ||
136 | let top_node = name_ref | 136 | let top_node = name_ref |
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index 2b3f98482..147ceda0c 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -28,7 +28,7 @@ impl Completions { | |||
28 | .add_to(self); | 28 | .add_to(self); |
29 | } | 29 | } |
30 | 30 | ||
31 | pub(crate) fn add_pos_field(&mut self, ctx: &CompletionContext, field: usize, ty: &hir::Ty) { | 31 | pub(crate) fn add_tuple_field(&mut self, ctx: &CompletionContext, field: usize, ty: &hir::Ty) { |
32 | CompletionItem::new(CompletionKind::Reference, ctx.source_range(), field.to_string()) | 32 | CompletionItem::new(CompletionKind::Reference, ctx.source_range(), field.to_string()) |
33 | .kind(CompletionItemKind::Field) | 33 | .kind(CompletionItemKind::Field) |
34 | .detail(ty.display(ctx.db).to_string()) | 34 | .detail(ty.display(ctx.db).to_string()) |
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 98b840b26..c2b959cb3 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs | |||
@@ -9,7 +9,7 @@ use ra_assists::ast_editor::{AstBuilder, AstEditor}; | |||
9 | use ra_db::SourceDatabase; | 9 | use ra_db::SourceDatabase; |
10 | use ra_prof::profile; | 10 | use ra_prof::profile; |
11 | use ra_syntax::{ | 11 | use ra_syntax::{ |
12 | ast::{self, AstNode, NamedField}, | 12 | ast::{self, AstNode, RecordField}, |
13 | Location, SyntaxNode, TextRange, T, | 13 | Location, SyntaxNode, TextRange, T, |
14 | }; | 14 | }; |
15 | use ra_text_edit::{TextEdit, TextEditBuilder}; | 15 | use ra_text_edit::{TextEdit, TextEditBuilder}; |
@@ -62,7 +62,7 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic> | |||
62 | let node = d.ast(db); | 62 | let node = d.ast(db); |
63 | let mut ast_editor = AstEditor::new(node); | 63 | let mut ast_editor = AstEditor::new(node); |
64 | for f in d.missed_fields.iter() { | 64 | for f in d.missed_fields.iter() { |
65 | ast_editor.append_field(&AstBuilder::<NamedField>::from_name(f)); | 65 | ast_editor.append_field(&AstBuilder::<RecordField>::from_name(f)); |
66 | } | 66 | } |
67 | 67 | ||
68 | let mut builder = TextEditBuilder::default(); | 68 | let mut builder = TextEditBuilder::default(); |
@@ -141,20 +141,20 @@ fn check_struct_shorthand_initialization( | |||
141 | file_id: FileId, | 141 | file_id: FileId, |
142 | node: &SyntaxNode, | 142 | node: &SyntaxNode, |
143 | ) -> Option<()> { | 143 | ) -> Option<()> { |
144 | let struct_lit = ast::StructLit::cast(node.clone())?; | 144 | let record_lit = ast::RecordLit::cast(node.clone())?; |
145 | let named_field_list = struct_lit.named_field_list()?; | 145 | let record_field_list = record_lit.record_field_list()?; |
146 | for named_field in named_field_list.fields() { | 146 | for record_field in record_field_list.fields() { |
147 | if let (Some(name_ref), Some(expr)) = (named_field.name_ref(), named_field.expr()) { | 147 | if let (Some(name_ref), Some(expr)) = (record_field.name_ref(), record_field.expr()) { |
148 | let field_name = name_ref.syntax().text().to_string(); | 148 | let field_name = name_ref.syntax().text().to_string(); |
149 | let field_expr = expr.syntax().text().to_string(); | 149 | let field_expr = expr.syntax().text().to_string(); |
150 | if field_name == field_expr { | 150 | if field_name == field_expr { |
151 | let mut edit_builder = TextEditBuilder::default(); | 151 | let mut edit_builder = TextEditBuilder::default(); |
152 | edit_builder.delete(named_field.syntax().text_range()); | 152 | edit_builder.delete(record_field.syntax().text_range()); |
153 | edit_builder.insert(named_field.syntax().text_range().start(), field_name); | 153 | edit_builder.insert(record_field.syntax().text_range().start(), field_name); |
154 | let edit = edit_builder.finish(); | 154 | let edit = edit_builder.finish(); |
155 | 155 | ||
156 | acc.push(Diagnostic { | 156 | acc.push(Diagnostic { |
157 | range: named_field.syntax().text_range(), | 157 | range: record_field.syntax().text_range(), |
158 | message: "Shorthand struct initialization".to_string(), | 158 | message: "Shorthand struct initialization".to_string(), |
159 | severity: Severity::WeakWarning, | 159 | severity: Severity::WeakWarning, |
160 | fix: Some(SourceChange::source_file_edit( | 160 | fix: Some(SourceChange::source_file_edit( |
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs index 84fabdb9e..c85214bb3 100644 --- a/crates/ra_ide_api/src/display/navigation_target.rs +++ b/crates/ra_ide_api/src/display/navigation_target.rs | |||
@@ -314,7 +314,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option | |||
314 | .visit(|it: ast::TypeAliasDef| it.doc_comment_text()) | 314 | .visit(|it: ast::TypeAliasDef| it.doc_comment_text()) |
315 | .visit(|it: ast::ConstDef| it.doc_comment_text()) | 315 | .visit(|it: ast::ConstDef| it.doc_comment_text()) |
316 | .visit(|it: ast::StaticDef| it.doc_comment_text()) | 316 | .visit(|it: ast::StaticDef| it.doc_comment_text()) |
317 | .visit(|it: ast::NamedFieldDef| it.doc_comment_text()) | 317 | .visit(|it: ast::RecordFieldDef| it.doc_comment_text()) |
318 | .visit(|it: ast::EnumVariant| it.doc_comment_text()) | 318 | .visit(|it: ast::EnumVariant| it.doc_comment_text()) |
319 | .visit(|it: ast::MacroCall| it.doc_comment_text()) | 319 | .visit(|it: ast::MacroCall| it.doc_comment_text()) |
320 | .accept(&node)? | 320 | .accept(&node)? |
@@ -336,7 +336,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> | |||
336 | .visit(|node: ast::TypeAliasDef| node.short_label()) | 336 | .visit(|node: ast::TypeAliasDef| node.short_label()) |
337 | .visit(|node: ast::ConstDef| node.short_label()) | 337 | .visit(|node: ast::ConstDef| node.short_label()) |
338 | .visit(|node: ast::StaticDef| node.short_label()) | 338 | .visit(|node: ast::StaticDef| node.short_label()) |
339 | .visit(|node: ast::NamedFieldDef| node.short_label()) | 339 | .visit(|node: ast::RecordFieldDef| node.short_label()) |
340 | .visit(|node: ast::EnumVariant| node.short_label()) | 340 | .visit(|node: ast::EnumVariant| node.short_label()) |
341 | .accept(&node)? | 341 | .accept(&node)? |
342 | } | 342 | } |
diff --git a/crates/ra_ide_api/src/display/short_label.rs b/crates/ra_ide_api/src/display/short_label.rs index 825a033ee..b16d504e1 100644 --- a/crates/ra_ide_api/src/display/short_label.rs +++ b/crates/ra_ide_api/src/display/short_label.rs | |||
@@ -53,7 +53,7 @@ impl ShortLabel for ast::StaticDef { | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | impl ShortLabel for ast::NamedFieldDef { | 56 | impl ShortLabel for ast::RecordFieldDef { |
57 | fn short_label(&self) -> Option<String> { | 57 | fn short_label(&self) -> Option<String> { |
58 | short_label_from_ascribed_node(self, "") | 58 | short_label_from_ascribed_node(self, "") |
59 | } | 59 | } |
diff --git a/crates/ra_ide_api/src/display/structure.rs b/crates/ra_ide_api/src/display/structure.rs index b026dfa59..a2025ed59 100644 --- a/crates/ra_ide_api/src/display/structure.rs +++ b/crates/ra_ide_api/src/display/structure.rs | |||
@@ -124,7 +124,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
124 | let ty = td.type_ref(); | 124 | let ty = td.type_ref(); |
125 | decl_with_type_ref(td, ty) | 125 | decl_with_type_ref(td, ty) |
126 | }) | 126 | }) |
127 | .visit(decl_with_ascription::<ast::NamedFieldDef>) | 127 | .visit(decl_with_ascription::<ast::RecordFieldDef>) |
128 | .visit(decl_with_ascription::<ast::ConstDef>) | 128 | .visit(decl_with_ascription::<ast::ConstDef>) |
129 | .visit(decl_with_ascription::<ast::StaticDef>) | 129 | .visit(decl_with_ascription::<ast::StaticDef>) |
130 | .visit(|im: ast::ImplBlock| { | 130 | .visit(|im: ast::ImplBlock| { |
@@ -222,7 +222,7 @@ fn very_obsolete() {} | |||
222 | label: "x", | 222 | label: "x", |
223 | navigation_range: [18; 19), | 223 | navigation_range: [18; 19), |
224 | node_range: [18; 24), | 224 | node_range: [18; 24), |
225 | kind: NAMED_FIELD_DEF, | 225 | kind: RECORD_FIELD_DEF, |
226 | detail: Some( | 226 | detail: Some( |
227 | "i32", | 227 | "i32", |
228 | ), | 228 | ), |
diff --git a/crates/ra_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs index edbf622c1..e990eb0d1 100644 --- a/crates/ra_ide_api/src/extend_selection.rs +++ b/crates/ra_ide_api/src/extend_selection.rs | |||
@@ -18,11 +18,11 @@ pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRang | |||
18 | fn try_extend_selection(root: &SyntaxNode, range: TextRange) -> Option<TextRange> { | 18 | fn try_extend_selection(root: &SyntaxNode, range: TextRange) -> Option<TextRange> { |
19 | let string_kinds = [COMMENT, STRING, RAW_STRING, BYTE_STRING, RAW_BYTE_STRING]; | 19 | let string_kinds = [COMMENT, STRING, RAW_STRING, BYTE_STRING, RAW_BYTE_STRING]; |
20 | let list_kinds = [ | 20 | let list_kinds = [ |
21 | FIELD_PAT_LIST, | 21 | RECORD_FIELD_PAT_LIST, |
22 | MATCH_ARM_LIST, | 22 | MATCH_ARM_LIST, |
23 | NAMED_FIELD_DEF_LIST, | 23 | RECORD_FIELD_DEF_LIST, |
24 | POS_FIELD_DEF_LIST, | 24 | TUPLE_FIELD_DEF_LIST, |
25 | NAMED_FIELD_LIST, | 25 | RECORD_FIELD_LIST, |
26 | ENUM_VARIANT_LIST, | 26 | ENUM_VARIANT_LIST, |
27 | USE_TREE_LIST, | 27 | USE_TREE_LIST, |
28 | TYPE_PARAM_LIST, | 28 | TYPE_PARAM_LIST, |
diff --git a/crates/ra_ide_api/src/folding_ranges.rs b/crates/ra_ide_api/src/folding_ranges.rs index e60ae8cf6..3ab6c195e 100644 --- a/crates/ra_ide_api/src/folding_ranges.rs +++ b/crates/ra_ide_api/src/folding_ranges.rs | |||
@@ -81,8 +81,14 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> { | |||
81 | match kind { | 81 | match kind { |
82 | COMMENT => Some(FoldKind::Comment), | 82 | COMMENT => Some(FoldKind::Comment), |
83 | USE_ITEM => Some(FoldKind::Imports), | 83 | USE_ITEM => Some(FoldKind::Imports), |
84 | NAMED_FIELD_DEF_LIST | FIELD_PAT_LIST | ITEM_LIST | EXTERN_ITEM_LIST | USE_TREE_LIST | 84 | RECORD_FIELD_DEF_LIST |
85 | | BLOCK | ENUM_VARIANT_LIST | TOKEN_TREE => Some(FoldKind::Block), | 85 | | RECORD_FIELD_PAT_LIST |
86 | | ITEM_LIST | ||
87 | | EXTERN_ITEM_LIST | ||
88 | | USE_TREE_LIST | ||
89 | | BLOCK | ||
90 | | ENUM_VARIANT_LIST | ||
91 | | TOKEN_TREE => Some(FoldKind::Block), | ||
86 | _ => None, | 92 | _ => None, |
87 | } | 93 | } |
88 | } | 94 | } |
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index ddd55a9c1..28529a2de 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -178,7 +178,7 @@ fn named_target(file_id: FileId, node: &SyntaxNode) -> Option<NavigationTarget> | |||
178 | node.short_label(), | 178 | node.short_label(), |
179 | ) | 179 | ) |
180 | }) | 180 | }) |
181 | .visit(|node: ast::NamedFieldDef| { | 181 | .visit(|node: ast::RecordFieldDef| { |
182 | NavigationTarget::from_named( | 182 | NavigationTarget::from_named( |
183 | file_id, | 183 | file_id, |
184 | &node, | 184 | &node, |
@@ -344,13 +344,13 @@ mod tests { | |||
344 | foo.spam<|>; | 344 | foo.spam<|>; |
345 | } | 345 | } |
346 | ", | 346 | ", |
347 | "spam NAMED_FIELD_DEF FileId(1) [17; 26) [17; 21)", | 347 | "spam RECORD_FIELD_DEF FileId(1) [17; 26) [17; 21)", |
348 | ); | 348 | ); |
349 | } | 349 | } |
350 | 350 | ||
351 | #[test] | 351 | #[test] |
352 | fn goto_definition_works_for_named_fields() { | 352 | fn goto_definition_works_for_record_fields() { |
353 | covers!(goto_definition_works_for_named_fields); | 353 | covers!(goto_definition_works_for_record_fields); |
354 | check_goto( | 354 | check_goto( |
355 | " | 355 | " |
356 | //- /lib.rs | 356 | //- /lib.rs |
@@ -364,7 +364,7 @@ mod tests { | |||
364 | } | 364 | } |
365 | } | 365 | } |
366 | ", | 366 | ", |
367 | "spam NAMED_FIELD_DEF FileId(1) [17; 26) [17; 21)", | 367 | "spam RECORD_FIELD_DEF FileId(1) [17; 26) [17; 21)", |
368 | ); | 368 | ); |
369 | } | 369 | } |
370 | #[test] | 370 | #[test] |
@@ -473,7 +473,7 @@ mod tests { | |||
473 | field<|>: string, | 473 | field<|>: string, |
474 | } | 474 | } |
475 | "#, | 475 | "#, |
476 | "field NAMED_FIELD_DEF FileId(1) [17; 30) [17; 22)", | 476 | "field RECORD_FIELD_DEF FileId(1) [17; 30) [17; 22)", |
477 | ); | 477 | ); |
478 | 478 | ||
479 | check_goto( | 479 | check_goto( |
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index 2a5ac7821..1981e62d3 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs | |||
@@ -197,7 +197,7 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn | |||
197 | .visit(|node: ast::TraitDef| { | 197 | .visit(|node: ast::TraitDef| { |
198 | hover_text(node.doc_comment_text(), node.short_label()) | 198 | hover_text(node.doc_comment_text(), node.short_label()) |
199 | }) | 199 | }) |
200 | .visit(|node: ast::NamedFieldDef| { | 200 | .visit(|node: ast::RecordFieldDef| { |
201 | hover_text(node.doc_comment_text(), node.short_label()) | 201 | hover_text(node.doc_comment_text(), node.short_label()) |
202 | }) | 202 | }) |
203 | .visit(|node: ast::Module| hover_text(node.doc_comment_text(), node.short_label())) | 203 | .visit(|node: ast::Module| hover_text(node.doc_comment_text(), node.short_label())) |
diff --git a/crates/ra_ide_api/src/inlay_hints.rs b/crates/ra_ide_api/src/inlay_hints.rs index 735f3166c..61ccb74b6 100644 --- a/crates/ra_ide_api/src/inlay_hints.rs +++ b/crates/ra_ide_api/src/inlay_hints.rs | |||
@@ -125,13 +125,13 @@ fn get_leaf_pats(root_pat: ast::Pat) -> Vec<ast::Pat> { | |||
125 | pats_to_process.push_back(arg_pat); | 125 | pats_to_process.push_back(arg_pat); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | ast::Pat::StructPat(struct_pat) => { | 128 | ast::Pat::RecordPat(record_pat) => { |
129 | if let Some(pat_list) = struct_pat.field_pat_list() { | 129 | if let Some(pat_list) = record_pat.record_field_pat_list() { |
130 | pats_to_process.extend( | 130 | pats_to_process.extend( |
131 | pat_list | 131 | pat_list |
132 | .field_pats() | 132 | .record_field_pats() |
133 | .filter_map(|field_pat| { | 133 | .filter_map(|record_field_pat| { |
134 | field_pat | 134 | record_field_pat |
135 | .pat() | 135 | .pat() |
136 | .filter(|pat| pat.syntax().kind() != SyntaxKind::BIND_PAT) | 136 | .filter(|pat| pat.syntax().kind() != SyntaxKind::BIND_PAT) |
137 | }) | 137 | }) |
diff --git a/crates/ra_ide_api/src/marks.rs b/crates/ra_ide_api/src/marks.rs index 9cb991de5..c3752cc54 100644 --- a/crates/ra_ide_api/src/marks.rs +++ b/crates/ra_ide_api/src/marks.rs | |||
@@ -3,7 +3,7 @@ test_utils::marks!( | |||
3 | goto_definition_works_for_macros | 3 | goto_definition_works_for_macros |
4 | goto_definition_works_for_methods | 4 | goto_definition_works_for_methods |
5 | goto_definition_works_for_fields | 5 | goto_definition_works_for_fields |
6 | goto_definition_works_for_named_fields | 6 | goto_definition_works_for_record_fields |
7 | call_info_bad_offset | 7 | call_info_bad_offset |
8 | dont_complete_current_use | 8 | dont_complete_current_use |
9 | dont_complete_primitive_in_use | 9 | dont_complete_primitive_in_use |
diff --git a/crates/ra_ide_api/src/name_ref_kind.rs b/crates/ra_ide_api/src/name_ref_kind.rs index f7db6c826..34a8bcc36 100644 --- a/crates/ra_ide_api/src/name_ref_kind.rs +++ b/crates/ra_ide_api/src/name_ref_kind.rs | |||
@@ -54,12 +54,12 @@ pub(crate) fn classify_name_ref( | |||
54 | } | 54 | } |
55 | 55 | ||
56 | // It could also be a named field | 56 | // It could also be a named field |
57 | if let Some(field_expr) = name_ref.syntax().parent().and_then(ast::NamedField::cast) { | 57 | if let Some(field_expr) = name_ref.syntax().parent().and_then(ast::RecordField::cast) { |
58 | tested_by!(goto_definition_works_for_named_fields); | 58 | tested_by!(goto_definition_works_for_record_fields); |
59 | 59 | ||
60 | let struct_lit = field_expr.syntax().ancestors().find_map(ast::StructLit::cast); | 60 | let record_lit = field_expr.syntax().ancestors().find_map(ast::RecordLit::cast); |
61 | 61 | ||
62 | if let Some(ty) = struct_lit.and_then(|lit| analyzer.type_of(db, &lit.into())) { | 62 | if let Some(ty) = record_lit.and_then(|lit| analyzer.type_of(db, &lit.into())) { |
63 | if let Some((hir::AdtDef::Struct(s), _)) = ty.as_adt() { | 63 | if let Some((hir::AdtDef::Struct(s), _)) = ty.as_adt() { |
64 | let hir_path = hir::Path::from_name_ref(name_ref); | 64 | let hir_path = hir::Path::from_name_ref(name_ref); |
65 | let hir_name = hir_path.as_ident().unwrap(); | 65 | let hir_name = hir_path.as_ident().unwrap(); |
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs index 448acffc8..06ccf0728 100644 --- a/crates/ra_ide_api/src/syntax_highlighting.rs +++ b/crates/ra_ide_api/src/syntax_highlighting.rs | |||
@@ -165,7 +165,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa | |||
165 | TYPE_PARAM | STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF => { | 165 | TYPE_PARAM | STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF => { |
166 | "type" | 166 | "type" |
167 | } | 167 | } |
168 | NAMED_FIELD_DEF => "field", | 168 | RECORD_FIELD_DEF => "field", |
169 | _ => "function", | 169 | _ => "function", |
170 | }) | 170 | }) |
171 | .unwrap_or("function") | 171 | .unwrap_or("function") |
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 0ad2ea10f..5fa52ec1b 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs | |||
@@ -42,7 +42,7 @@ impl Conv for SyntaxKind { | |||
42 | SyntaxKind::TRAIT_DEF => SymbolKind::Interface, | 42 | SyntaxKind::TRAIT_DEF => SymbolKind::Interface, |
43 | SyntaxKind::MODULE => SymbolKind::Module, | 43 | SyntaxKind::MODULE => SymbolKind::Module, |
44 | SyntaxKind::TYPE_ALIAS_DEF => SymbolKind::TypeParameter, | 44 | SyntaxKind::TYPE_ALIAS_DEF => SymbolKind::TypeParameter, |
45 | SyntaxKind::NAMED_FIELD_DEF => SymbolKind::Field, | 45 | SyntaxKind::RECORD_FIELD_DEF => SymbolKind::Field, |
46 | SyntaxKind::STATIC_DEF => SymbolKind::Constant, | 46 | SyntaxKind::STATIC_DEF => SymbolKind::Constant, |
47 | SyntaxKind::CONST_DEF => SymbolKind::Constant, | 47 | SyntaxKind::CONST_DEF => SymbolKind::Constant, |
48 | SyntaxKind::IMPL_BLOCK => SymbolKind::Object, | 48 | SyntaxKind::IMPL_BLOCK => SymbolKind::Object, |
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index 192e9007d..1dbf22997 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs | |||
@@ -419,9 +419,9 @@ MACRO_ITEMS@[0; 40) | |||
419 | STRUCT_KW@[0; 6) "struct" | 419 | STRUCT_KW@[0; 6) "struct" |
420 | NAME@[6; 9) | 420 | NAME@[6; 9) |
421 | IDENT@[6; 9) "Foo" | 421 | IDENT@[6; 9) "Foo" |
422 | NAMED_FIELD_DEF_LIST@[9; 20) | 422 | RECORD_FIELD_DEF_LIST@[9; 20) |
423 | L_CURLY@[9; 10) "{" | 423 | L_CURLY@[9; 10) "{" |
424 | NAMED_FIELD_DEF@[10; 19) | 424 | RECORD_FIELD_DEF@[10; 19) |
425 | NAME@[10; 15) | 425 | NAME@[10; 15) |
426 | IDENT@[10; 15) "field" | 426 | IDENT@[10; 15) "field" |
427 | COLON@[15; 16) ":" | 427 | COLON@[15; 16) ":" |
@@ -435,9 +435,9 @@ MACRO_ITEMS@[0; 40) | |||
435 | STRUCT_KW@[20; 26) "struct" | 435 | STRUCT_KW@[20; 26) "struct" |
436 | NAME@[26; 29) | 436 | NAME@[26; 29) |
437 | IDENT@[26; 29) "Bar" | 437 | IDENT@[26; 29) "Bar" |
438 | NAMED_FIELD_DEF_LIST@[29; 40) | 438 | RECORD_FIELD_DEF_LIST@[29; 40) |
439 | L_CURLY@[29; 30) "{" | 439 | L_CURLY@[29; 30) "{" |
440 | NAMED_FIELD_DEF@[30; 39) | 440 | RECORD_FIELD_DEF@[30; 39) |
441 | NAME@[30; 35) | 441 | NAME@[30; 35) |
442 | IDENT@[30; 35) "field" | 442 | IDENT@[30; 35) "field" |
443 | COLON@[35; 36) ":" | 443 | COLON@[35; 36) ":" |
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index beedac457..dee3a229d 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -150,8 +150,8 @@ pub(crate) fn reparser( | |||
150 | ) -> Option<fn(&mut Parser)> { | 150 | ) -> Option<fn(&mut Parser)> { |
151 | let res = match node { | 151 | let res = match node { |
152 | BLOCK => expressions::block, | 152 | BLOCK => expressions::block, |
153 | NAMED_FIELD_DEF_LIST => items::named_field_def_list, | 153 | RECORD_FIELD_DEF_LIST => items::record_field_def_list, |
154 | NAMED_FIELD_LIST => items::named_field_list, | 154 | RECORD_FIELD_LIST => items::record_field_list, |
155 | ENUM_VARIANT_LIST => items::enum_variant_list, | 155 | ENUM_VARIANT_LIST => items::enum_variant_list, |
156 | MATCH_ARM_LIST => items::match_arm_list, | 156 | MATCH_ARM_LIST => items::match_arm_list, |
157 | USE_TREE_LIST => items::use_tree_list, | 157 | USE_TREE_LIST => items::use_tree_list, |
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 0495f34ae..783d6a6f0 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -559,8 +559,8 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { | |||
559 | paths::expr_path(p); | 559 | paths::expr_path(p); |
560 | match p.current() { | 560 | match p.current() { |
561 | T!['{'] if !r.forbid_structs => { | 561 | T!['{'] if !r.forbid_structs => { |
562 | named_field_list(p); | 562 | record_field_list(p); |
563 | (m.complete(p, STRUCT_LIT), BlockLike::NotBlock) | 563 | (m.complete(p, RECORD_LIT), BlockLike::NotBlock) |
564 | } | 564 | } |
565 | T![!] => { | 565 | T![!] => { |
566 | let block_like = items::macro_call_after_excl(p); | 566 | let block_like = items::macro_call_after_excl(p); |
@@ -570,20 +570,20 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { | |||
570 | } | 570 | } |
571 | } | 571 | } |
572 | 572 | ||
573 | // test struct_lit | 573 | // test record_lit |
574 | // fn foo() { | 574 | // fn foo() { |
575 | // S {}; | 575 | // S {}; |
576 | // S { x, y: 32, }; | 576 | // S { x, y: 32, }; |
577 | // S { x, y: 32, ..Default::default() }; | 577 | // S { x, y: 32, ..Default::default() }; |
578 | // TupleStruct { 0: 1 }; | 578 | // TupleStruct { 0: 1 }; |
579 | // } | 579 | // } |
580 | pub(crate) fn named_field_list(p: &mut Parser) { | 580 | pub(crate) fn record_field_list(p: &mut Parser) { |
581 | assert!(p.at(T!['{'])); | 581 | assert!(p.at(T!['{'])); |
582 | let m = p.start(); | 582 | let m = p.start(); |
583 | p.bump(); | 583 | p.bump(); |
584 | while !p.at(EOF) && !p.at(T!['}']) { | 584 | while !p.at(EOF) && !p.at(T!['}']) { |
585 | match p.current() { | 585 | match p.current() { |
586 | // test struct_literal_field_with_attr | 586 | // test record_literal_field_with_attr |
587 | // fn main() { | 587 | // fn main() { |
588 | // S { #[cfg(test)] field: 1 } | 588 | // S { #[cfg(test)] field: 1 } |
589 | // } | 589 | // } |
@@ -594,7 +594,7 @@ pub(crate) fn named_field_list(p: &mut Parser) { | |||
594 | if p.eat(T![:]) { | 594 | if p.eat(T![:]) { |
595 | expr(p); | 595 | expr(p); |
596 | } | 596 | } |
597 | m.complete(p, NAMED_FIELD); | 597 | m.complete(p, RECORD_FIELD); |
598 | } | 598 | } |
599 | T![..] => { | 599 | T![..] => { |
600 | p.bump(); | 600 | p.bump(); |
@@ -608,5 +608,5 @@ pub(crate) fn named_field_list(p: &mut Parser) { | |||
608 | } | 608 | } |
609 | } | 609 | } |
610 | p.expect(T!['}']); | 610 | p.expect(T!['}']); |
611 | m.complete(p, NAMED_FIELD_LIST); | 611 | m.complete(p, RECORD_FIELD_LIST); |
612 | } | 612 | } |
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index b7da44758..6d426206e 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs | |||
@@ -4,8 +4,8 @@ mod traits; | |||
4 | mod use_item; | 4 | mod use_item; |
5 | 5 | ||
6 | pub(crate) use self::{ | 6 | pub(crate) use self::{ |
7 | expressions::{match_arm_list, named_field_list}, | 7 | expressions::{match_arm_list, record_field_list}, |
8 | nominal::{enum_variant_list, named_field_def_list}, | 8 | nominal::{enum_variant_list, record_field_def_list}, |
9 | traits::{impl_item_list, trait_item_list}, | 9 | traits::{impl_item_list, trait_item_list}, |
10 | use_item::use_tree_list, | 10 | use_item::use_tree_list, |
11 | }; | 11 | }; |
diff --git a/crates/ra_parser/src/grammar/items/nominal.rs b/crates/ra_parser/src/grammar/items/nominal.rs index bd4edab89..54f02c7c9 100644 --- a/crates/ra_parser/src/grammar/items/nominal.rs +++ b/crates/ra_parser/src/grammar/items/nominal.rs | |||
@@ -13,7 +13,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { | |||
13 | T![;] => { | 13 | T![;] => { |
14 | p.bump(); | 14 | p.bump(); |
15 | } | 15 | } |
16 | T!['{'] => named_field_def_list(p), | 16 | T!['{'] => record_field_def_list(p), |
17 | _ => { | 17 | _ => { |
18 | //FIXME: special case `(` error message | 18 | //FIXME: special case `(` error message |
19 | p.error("expected `;` or `{`"); | 19 | p.error("expected `;` or `{`"); |
@@ -23,9 +23,9 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker, kind: SyntaxKind) { | |||
23 | T![;] if kind == T![struct] => { | 23 | T![;] if kind == T![struct] => { |
24 | p.bump(); | 24 | p.bump(); |
25 | } | 25 | } |
26 | T!['{'] => named_field_def_list(p), | 26 | T!['{'] => record_field_def_list(p), |
27 | T!['('] if kind == T![struct] => { | 27 | T!['('] if kind == T![struct] => { |
28 | pos_field_def_list(p); | 28 | tuple_field_def_list(p); |
29 | // test tuple_struct_where | 29 | // test tuple_struct_where |
30 | // struct Test<T>(T) where T: Clone; | 30 | // struct Test<T>(T) where T: Clone; |
31 | // struct Test<T>(T); | 31 | // struct Test<T>(T); |
@@ -70,8 +70,8 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
70 | if p.at(IDENT) { | 70 | if p.at(IDENT) { |
71 | name(p); | 71 | name(p); |
72 | match p.current() { | 72 | match p.current() { |
73 | T!['{'] => named_field_def_list(p), | 73 | T!['{'] => record_field_def_list(p), |
74 | T!['('] => pos_field_def_list(p), | 74 | T!['('] => tuple_field_def_list(p), |
75 | T![=] => { | 75 | T![=] => { |
76 | p.bump(); | 76 | p.bump(); |
77 | expressions::expr(p); | 77 | expressions::expr(p); |
@@ -91,7 +91,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
91 | m.complete(p, ENUM_VARIANT_LIST); | 91 | m.complete(p, ENUM_VARIANT_LIST); |
92 | } | 92 | } |
93 | 93 | ||
94 | pub(crate) fn named_field_def_list(p: &mut Parser) { | 94 | pub(crate) fn record_field_def_list(p: &mut Parser) { |
95 | assert!(p.at(T!['{'])); | 95 | assert!(p.at(T!['{'])); |
96 | let m = p.start(); | 96 | let m = p.start(); |
97 | p.bump(); | 97 | p.bump(); |
@@ -100,17 +100,17 @@ pub(crate) fn named_field_def_list(p: &mut Parser) { | |||
100 | error_block(p, "expected field"); | 100 | error_block(p, "expected field"); |
101 | continue; | 101 | continue; |
102 | } | 102 | } |
103 | named_field_def(p); | 103 | record_field_def(p); |
104 | if !p.at(T!['}']) { | 104 | if !p.at(T!['}']) { |
105 | p.expect(T![,]); | 105 | p.expect(T![,]); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | p.expect(T!['}']); | 108 | p.expect(T!['}']); |
109 | m.complete(p, NAMED_FIELD_DEF_LIST); | 109 | m.complete(p, RECORD_FIELD_DEF_LIST); |
110 | 110 | ||
111 | fn named_field_def(p: &mut Parser) { | 111 | fn record_field_def(p: &mut Parser) { |
112 | let m = p.start(); | 112 | let m = p.start(); |
113 | // test field_attrs | 113 | // test record_field_attrs |
114 | // struct S { | 114 | // struct S { |
115 | // #[serde(with = "url_serde")] | 115 | // #[serde(with = "url_serde")] |
116 | // pub uri: Uri, | 116 | // pub uri: Uri, |
@@ -121,7 +121,7 @@ pub(crate) fn named_field_def_list(p: &mut Parser) { | |||
121 | name(p); | 121 | name(p); |
122 | p.expect(T![:]); | 122 | p.expect(T![:]); |
123 | types::type_(p); | 123 | types::type_(p); |
124 | m.complete(p, NAMED_FIELD_DEF); | 124 | m.complete(p, RECORD_FIELD_DEF); |
125 | } else { | 125 | } else { |
126 | m.abandon(p); | 126 | m.abandon(p); |
127 | p.err_and_bump("expected field declaration"); | 127 | p.err_and_bump("expected field declaration"); |
@@ -129,7 +129,7 @@ pub(crate) fn named_field_def_list(p: &mut Parser) { | |||
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | fn pos_field_def_list(p: &mut Parser) { | 132 | fn tuple_field_def_list(p: &mut Parser) { |
133 | assert!(p.at(T!['('])); | 133 | assert!(p.at(T!['('])); |
134 | let m = p.start(); | 134 | let m = p.start(); |
135 | if !p.expect(T!['(']) { | 135 | if !p.expect(T!['(']) { |
@@ -137,7 +137,7 @@ fn pos_field_def_list(p: &mut Parser) { | |||
137 | } | 137 | } |
138 | while !p.at(T![')']) && !p.at(EOF) { | 138 | while !p.at(T![')']) && !p.at(EOF) { |
139 | let m = p.start(); | 139 | let m = p.start(); |
140 | // test pos_field_attrs | 140 | // test tuple_field_attrs |
141 | // struct S ( | 141 | // struct S ( |
142 | // #[serde(with = "url_serde")] | 142 | // #[serde(with = "url_serde")] |
143 | // pub Uri, | 143 | // pub Uri, |
@@ -154,12 +154,12 @@ fn pos_field_def_list(p: &mut Parser) { | |||
154 | break; | 154 | break; |
155 | } | 155 | } |
156 | types::type_(p); | 156 | types::type_(p); |
157 | m.complete(p, POS_FIELD_DEF); | 157 | m.complete(p, TUPLE_FIELD_DEF); |
158 | 158 | ||
159 | if !p.at(T![')']) { | 159 | if !p.at(T![')']) { |
160 | p.expect(T![,]); | 160 | p.expect(T![,]); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | p.expect(T![')']); | 163 | p.expect(T![')']); |
164 | m.complete(p, POS_FIELD_DEF_LIST); | 164 | m.complete(p, TUPLE_FIELD_DEF_LIST); |
165 | } | 165 | } |
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs index 1f6a6fd48..8979aa499 100644 --- a/crates/ra_parser/src/grammar/patterns.rs +++ b/crates/ra_parser/src/grammar/patterns.rs | |||
@@ -127,8 +127,8 @@ fn path_pat(p: &mut Parser) -> CompletedMarker { | |||
127 | TUPLE_STRUCT_PAT | 127 | TUPLE_STRUCT_PAT |
128 | } | 128 | } |
129 | T!['{'] => { | 129 | T!['{'] => { |
130 | field_pat_list(p); | 130 | record_field_pat_list(p); |
131 | STRUCT_PAT | 131 | RECORD_PAT |
132 | } | 132 | } |
133 | _ => PATH_PAT, | 133 | _ => PATH_PAT, |
134 | }; | 134 | }; |
@@ -149,21 +149,21 @@ fn tuple_pat_fields(p: &mut Parser) { | |||
149 | p.expect(T![')']); | 149 | p.expect(T![')']); |
150 | } | 150 | } |
151 | 151 | ||
152 | // test field_pat_list | 152 | // test record_field_pat_list |
153 | // fn foo() { | 153 | // fn foo() { |
154 | // let S {} = (); | 154 | // let S {} = (); |
155 | // let S { f, ref mut g } = (); | 155 | // let S { f, ref mut g } = (); |
156 | // let S { h: _, ..} = (); | 156 | // let S { h: _, ..} = (); |
157 | // let S { h: _, } = (); | 157 | // let S { h: _, } = (); |
158 | // } | 158 | // } |
159 | fn field_pat_list(p: &mut Parser) { | 159 | fn record_field_pat_list(p: &mut Parser) { |
160 | assert!(p.at(T!['{'])); | 160 | assert!(p.at(T!['{'])); |
161 | let m = p.start(); | 161 | let m = p.start(); |
162 | p.bump(); | 162 | p.bump(); |
163 | while !p.at(EOF) && !p.at(T!['}']) { | 163 | while !p.at(EOF) && !p.at(T!['}']) { |
164 | match p.current() { | 164 | match p.current() { |
165 | T![..] => p.bump(), | 165 | T![..] => p.bump(), |
166 | IDENT if p.nth(1) == T![:] => field_pat(p), | 166 | IDENT if p.nth(1) == T![:] => record_field_pat(p), |
167 | T!['{'] => error_block(p, "expected ident"), | 167 | T!['{'] => error_block(p, "expected ident"), |
168 | _ => { | 168 | _ => { |
169 | bind_pat(p, false); | 169 | bind_pat(p, false); |
@@ -174,10 +174,10 @@ fn field_pat_list(p: &mut Parser) { | |||
174 | } | 174 | } |
175 | } | 175 | } |
176 | p.expect(T!['}']); | 176 | p.expect(T!['}']); |
177 | m.complete(p, FIELD_PAT_LIST); | 177 | m.complete(p, RECORD_FIELD_PAT_LIST); |
178 | } | 178 | } |
179 | 179 | ||
180 | fn field_pat(p: &mut Parser) { | 180 | fn record_field_pat(p: &mut Parser) { |
181 | assert!(p.at(IDENT)); | 181 | assert!(p.at(IDENT)); |
182 | assert!(p.nth(1) == T![:]); | 182 | assert!(p.nth(1) == T![:]); |
183 | 183 | ||
@@ -185,7 +185,7 @@ fn field_pat(p: &mut Parser) { | |||
185 | name(p); | 185 | name(p); |
186 | p.bump(); | 186 | p.bump(); |
187 | pattern(p); | 187 | pattern(p); |
188 | m.complete(p, FIELD_PAT); | 188 | m.complete(p, RECORD_FIELD_PAT); |
189 | } | 189 | } |
190 | 190 | ||
191 | // test placeholder_pat | 191 | // test placeholder_pat |
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 3a67d7ddd..f15e98e68 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -152,9 +152,9 @@ pub enum SyntaxKind { | |||
152 | BIND_PAT, | 152 | BIND_PAT, |
153 | PLACEHOLDER_PAT, | 153 | PLACEHOLDER_PAT, |
154 | PATH_PAT, | 154 | PATH_PAT, |
155 | STRUCT_PAT, | 155 | RECORD_PAT, |
156 | FIELD_PAT_LIST, | 156 | RECORD_FIELD_PAT_LIST, |
157 | FIELD_PAT, | 157 | RECORD_FIELD_PAT, |
158 | TUPLE_STRUCT_PAT, | 158 | TUPLE_STRUCT_PAT, |
159 | TUPLE_PAT, | 159 | TUPLE_PAT, |
160 | SLICE_PAT, | 160 | SLICE_PAT, |
@@ -179,9 +179,9 @@ pub enum SyntaxKind { | |||
179 | MATCH_ARM_LIST, | 179 | MATCH_ARM_LIST, |
180 | MATCH_ARM, | 180 | MATCH_ARM, |
181 | MATCH_GUARD, | 181 | MATCH_GUARD, |
182 | STRUCT_LIT, | 182 | RECORD_LIT, |
183 | NAMED_FIELD_LIST, | 183 | RECORD_FIELD_LIST, |
184 | NAMED_FIELD, | 184 | RECORD_FIELD, |
185 | TRY_BLOCK_EXPR, | 185 | TRY_BLOCK_EXPR, |
186 | BOX_EXPR, | 186 | BOX_EXPR, |
187 | CALL_EXPR, | 187 | CALL_EXPR, |
@@ -199,10 +199,10 @@ pub enum SyntaxKind { | |||
199 | EXTERN_BLOCK, | 199 | EXTERN_BLOCK, |
200 | EXTERN_ITEM_LIST, | 200 | EXTERN_ITEM_LIST, |
201 | ENUM_VARIANT, | 201 | ENUM_VARIANT, |
202 | NAMED_FIELD_DEF_LIST, | 202 | RECORD_FIELD_DEF_LIST, |
203 | NAMED_FIELD_DEF, | 203 | RECORD_FIELD_DEF, |
204 | POS_FIELD_DEF_LIST, | 204 | TUPLE_FIELD_DEF_LIST, |
205 | POS_FIELD_DEF, | 205 | TUPLE_FIELD_DEF, |
206 | ENUM_VARIANT_LIST, | 206 | ENUM_VARIANT_LIST, |
207 | ITEM_LIST, | 207 | ITEM_LIST, |
208 | ATTR, | 208 | ATTR, |
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs index cf5b6f251..d7ea4354d 100644 --- a/crates/ra_syntax/src/ast/expr_extensions.rs +++ b/crates/ra_syntax/src/ast/expr_extensions.rs | |||
@@ -296,8 +296,8 @@ fn test_literal_with_attr() { | |||
296 | assert_eq!(lit.token().text(), r#""Hello""#); | 296 | assert_eq!(lit.token().text(), r#""Hello""#); |
297 | } | 297 | } |
298 | 298 | ||
299 | impl ast::NamedField { | 299 | impl ast::RecordField { |
300 | pub fn parent_struct_lit(&self) -> ast::StructLit { | 300 | pub fn parent_record_lit(&self) -> ast::RecordLit { |
301 | self.syntax().ancestors().find_map(ast::StructLit::cast).unwrap() | 301 | self.syntax().ancestors().find_map(ast::RecordLit::cast).unwrap() |
302 | } | 302 | } |
303 | } | 303 | } |
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index e0ea3e5ab..d3a375f87 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -195,16 +195,16 @@ impl ast::ImplBlock { | |||
195 | 195 | ||
196 | #[derive(Debug, Clone, PartialEq, Eq)] | 196 | #[derive(Debug, Clone, PartialEq, Eq)] |
197 | pub enum StructKind { | 197 | pub enum StructKind { |
198 | Tuple(ast::PosFieldDefList), | 198 | Tuple(ast::TupleFieldDefList), |
199 | Named(ast::NamedFieldDefList), | 199 | Named(ast::RecordFieldDefList), |
200 | Unit, | 200 | Unit, |
201 | } | 201 | } |
202 | 202 | ||
203 | impl StructKind { | 203 | impl StructKind { |
204 | fn from_node<N: AstNode>(node: &N) -> StructKind { | 204 | fn from_node<N: AstNode>(node: &N) -> StructKind { |
205 | if let Some(nfdl) = child_opt::<_, ast::NamedFieldDefList>(node) { | 205 | if let Some(nfdl) = child_opt::<_, ast::RecordFieldDefList>(node) { |
206 | StructKind::Named(nfdl) | 206 | StructKind::Named(nfdl) |
207 | } else if let Some(pfl) = child_opt::<_, ast::PosFieldDefList>(node) { | 207 | } else if let Some(pfl) = child_opt::<_, ast::TupleFieldDefList>(node) { |
208 | StructKind::Tuple(pfl) | 208 | StructKind::Tuple(pfl) |
209 | } else { | 209 | } else { |
210 | StructKind::Unit | 210 | StructKind::Unit |
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 9c5789701..07cc3e0db 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -607,7 +607,7 @@ pub enum Expr { | |||
607 | BlockExpr(BlockExpr), | 607 | BlockExpr(BlockExpr), |
608 | ReturnExpr(ReturnExpr), | 608 | ReturnExpr(ReturnExpr), |
609 | MatchExpr(MatchExpr), | 609 | MatchExpr(MatchExpr), |
610 | StructLit(StructLit), | 610 | RecordLit(RecordLit), |
611 | CallExpr(CallExpr), | 611 | CallExpr(CallExpr), |
612 | IndexExpr(IndexExpr), | 612 | IndexExpr(IndexExpr), |
613 | MethodCallExpr(MethodCallExpr), | 613 | MethodCallExpr(MethodCallExpr), |
@@ -698,9 +698,9 @@ impl From<MatchExpr> for Expr { | |||
698 | Expr::MatchExpr(node) | 698 | Expr::MatchExpr(node) |
699 | } | 699 | } |
700 | } | 700 | } |
701 | impl From<StructLit> for Expr { | 701 | impl From<RecordLit> for Expr { |
702 | fn from(node: StructLit) -> Expr { | 702 | fn from(node: RecordLit) -> Expr { |
703 | Expr::StructLit(node) | 703 | Expr::RecordLit(node) |
704 | } | 704 | } |
705 | } | 705 | } |
706 | impl From<CallExpr> for Expr { | 706 | impl From<CallExpr> for Expr { |
@@ -778,7 +778,7 @@ impl AstNode for Expr { | |||
778 | match kind { | 778 | match kind { |
779 | TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR | 779 | TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR |
780 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL | 780 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL |
781 | | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | STRUCT_LIT | CALL_EXPR | INDEX_EXPR | 781 | | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR |
782 | | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | TRY_BLOCK_EXPR | 782 | | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | TRY_BLOCK_EXPR |
783 | | CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL => { | 783 | | CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL => { |
784 | true | 784 | true |
@@ -803,7 +803,7 @@ impl AstNode for Expr { | |||
803 | BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), | 803 | BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), |
804 | RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), | 804 | RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), |
805 | MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), | 805 | MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), |
806 | STRUCT_LIT => Expr::StructLit(StructLit { syntax }), | 806 | RECORD_LIT => Expr::RecordLit(RecordLit { syntax }), |
807 | CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), | 807 | CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), |
808 | INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), | 808 | INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), |
809 | METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), | 809 | METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), |
@@ -839,7 +839,7 @@ impl AstNode for Expr { | |||
839 | Expr::BlockExpr(it) => &it.syntax, | 839 | Expr::BlockExpr(it) => &it.syntax, |
840 | Expr::ReturnExpr(it) => &it.syntax, | 840 | Expr::ReturnExpr(it) => &it.syntax, |
841 | Expr::MatchExpr(it) => &it.syntax, | 841 | Expr::MatchExpr(it) => &it.syntax, |
842 | Expr::StructLit(it) => &it.syntax, | 842 | Expr::RecordLit(it) => &it.syntax, |
843 | Expr::CallExpr(it) => &it.syntax, | 843 | Expr::CallExpr(it) => &it.syntax, |
844 | Expr::IndexExpr(it) => &it.syntax, | 844 | Expr::IndexExpr(it) => &it.syntax, |
845 | Expr::MethodCallExpr(it) => &it.syntax, | 845 | Expr::MethodCallExpr(it) => &it.syntax, |
@@ -946,64 +946,6 @@ impl FieldExpr { | |||
946 | } | 946 | } |
947 | } | 947 | } |
948 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 948 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
949 | pub struct FieldPat { | ||
950 | pub(crate) syntax: SyntaxNode, | ||
951 | } | ||
952 | impl AstNode for FieldPat { | ||
953 | fn can_cast(kind: SyntaxKind) -> bool { | ||
954 | match kind { | ||
955 | FIELD_PAT => true, | ||
956 | _ => false, | ||
957 | } | ||
958 | } | ||
959 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
960 | if Self::can_cast(syntax.kind()) { | ||
961 | Some(Self { syntax }) | ||
962 | } else { | ||
963 | None | ||
964 | } | ||
965 | } | ||
966 | fn syntax(&self) -> &SyntaxNode { | ||
967 | &self.syntax | ||
968 | } | ||
969 | } | ||
970 | impl ast::NameOwner for FieldPat {} | ||
971 | impl FieldPat { | ||
972 | pub fn pat(&self) -> Option<Pat> { | ||
973 | AstChildren::new(&self.syntax).next() | ||
974 | } | ||
975 | } | ||
976 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
977 | pub struct FieldPatList { | ||
978 | pub(crate) syntax: SyntaxNode, | ||
979 | } | ||
980 | impl AstNode for FieldPatList { | ||
981 | fn can_cast(kind: SyntaxKind) -> bool { | ||
982 | match kind { | ||
983 | FIELD_PAT_LIST => true, | ||
984 | _ => false, | ||
985 | } | ||
986 | } | ||
987 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
988 | if Self::can_cast(syntax.kind()) { | ||
989 | Some(Self { syntax }) | ||
990 | } else { | ||
991 | None | ||
992 | } | ||
993 | } | ||
994 | fn syntax(&self) -> &SyntaxNode { | ||
995 | &self.syntax | ||
996 | } | ||
997 | } | ||
998 | impl FieldPatList { | ||
999 | pub fn field_pats(&self) -> AstChildren<FieldPat> { | ||
1000 | AstChildren::new(&self.syntax) | ||
1001 | } | ||
1002 | pub fn bind_pats(&self) -> AstChildren<BindPat> { | ||
1003 | AstChildren::new(&self.syntax) | ||
1004 | } | ||
1005 | } | ||
1006 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1007 | pub struct FnDef { | 949 | pub struct FnDef { |
1008 | pub(crate) syntax: SyntaxNode, | 950 | pub(crate) syntax: SyntaxNode, |
1009 | } | 951 | } |
@@ -1942,121 +1884,6 @@ impl AstNode for NameRef { | |||
1942 | } | 1884 | } |
1943 | impl NameRef {} | 1885 | impl NameRef {} |
1944 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1886 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1945 | pub struct NamedField { | ||
1946 | pub(crate) syntax: SyntaxNode, | ||
1947 | } | ||
1948 | impl AstNode for NamedField { | ||
1949 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1950 | match kind { | ||
1951 | NAMED_FIELD => true, | ||
1952 | _ => false, | ||
1953 | } | ||
1954 | } | ||
1955 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1956 | if Self::can_cast(syntax.kind()) { | ||
1957 | Some(Self { syntax }) | ||
1958 | } else { | ||
1959 | None | ||
1960 | } | ||
1961 | } | ||
1962 | fn syntax(&self) -> &SyntaxNode { | ||
1963 | &self.syntax | ||
1964 | } | ||
1965 | } | ||
1966 | impl NamedField { | ||
1967 | pub fn name_ref(&self) -> Option<NameRef> { | ||
1968 | AstChildren::new(&self.syntax).next() | ||
1969 | } | ||
1970 | pub fn expr(&self) -> Option<Expr> { | ||
1971 | AstChildren::new(&self.syntax).next() | ||
1972 | } | ||
1973 | } | ||
1974 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1975 | pub struct NamedFieldDef { | ||
1976 | pub(crate) syntax: SyntaxNode, | ||
1977 | } | ||
1978 | impl AstNode for NamedFieldDef { | ||
1979 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1980 | match kind { | ||
1981 | NAMED_FIELD_DEF => true, | ||
1982 | _ => false, | ||
1983 | } | ||
1984 | } | ||
1985 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1986 | if Self::can_cast(syntax.kind()) { | ||
1987 | Some(Self { syntax }) | ||
1988 | } else { | ||
1989 | None | ||
1990 | } | ||
1991 | } | ||
1992 | fn syntax(&self) -> &SyntaxNode { | ||
1993 | &self.syntax | ||
1994 | } | ||
1995 | } | ||
1996 | impl ast::VisibilityOwner for NamedFieldDef {} | ||
1997 | impl ast::NameOwner for NamedFieldDef {} | ||
1998 | impl ast::AttrsOwner for NamedFieldDef {} | ||
1999 | impl ast::DocCommentsOwner for NamedFieldDef {} | ||
2000 | impl ast::TypeAscriptionOwner for NamedFieldDef {} | ||
2001 | impl NamedFieldDef {} | ||
2002 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2003 | pub struct NamedFieldDefList { | ||
2004 | pub(crate) syntax: SyntaxNode, | ||
2005 | } | ||
2006 | impl AstNode for NamedFieldDefList { | ||
2007 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2008 | match kind { | ||
2009 | NAMED_FIELD_DEF_LIST => true, | ||
2010 | _ => false, | ||
2011 | } | ||
2012 | } | ||
2013 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2014 | if Self::can_cast(syntax.kind()) { | ||
2015 | Some(Self { syntax }) | ||
2016 | } else { | ||
2017 | None | ||
2018 | } | ||
2019 | } | ||
2020 | fn syntax(&self) -> &SyntaxNode { | ||
2021 | &self.syntax | ||
2022 | } | ||
2023 | } | ||
2024 | impl NamedFieldDefList { | ||
2025 | pub fn fields(&self) -> AstChildren<NamedFieldDef> { | ||
2026 | AstChildren::new(&self.syntax) | ||
2027 | } | ||
2028 | } | ||
2029 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2030 | pub struct NamedFieldList { | ||
2031 | pub(crate) syntax: SyntaxNode, | ||
2032 | } | ||
2033 | impl AstNode for NamedFieldList { | ||
2034 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2035 | match kind { | ||
2036 | NAMED_FIELD_LIST => true, | ||
2037 | _ => false, | ||
2038 | } | ||
2039 | } | ||
2040 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2041 | if Self::can_cast(syntax.kind()) { | ||
2042 | Some(Self { syntax }) | ||
2043 | } else { | ||
2044 | None | ||
2045 | } | ||
2046 | } | ||
2047 | fn syntax(&self) -> &SyntaxNode { | ||
2048 | &self.syntax | ||
2049 | } | ||
2050 | } | ||
2051 | impl NamedFieldList { | ||
2052 | pub fn fields(&self) -> AstChildren<NamedField> { | ||
2053 | AstChildren::new(&self.syntax) | ||
2054 | } | ||
2055 | pub fn spread(&self) -> Option<Expr> { | ||
2056 | AstChildren::new(&self.syntax).next() | ||
2057 | } | ||
2058 | } | ||
2059 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2060 | pub struct NeverType { | 1887 | pub struct NeverType { |
2061 | pub(crate) syntax: SyntaxNode, | 1888 | pub(crate) syntax: SyntaxNode, |
2062 | } | 1889 | } |
@@ -2239,7 +2066,7 @@ pub enum Pat { | |||
2239 | BindPat(BindPat), | 2066 | BindPat(BindPat), |
2240 | PlaceholderPat(PlaceholderPat), | 2067 | PlaceholderPat(PlaceholderPat), |
2241 | PathPat(PathPat), | 2068 | PathPat(PathPat), |
2242 | StructPat(StructPat), | 2069 | RecordPat(RecordPat), |
2243 | TupleStructPat(TupleStructPat), | 2070 | TupleStructPat(TupleStructPat), |
2244 | TuplePat(TuplePat), | 2071 | TuplePat(TuplePat), |
2245 | SlicePat(SlicePat), | 2072 | SlicePat(SlicePat), |
@@ -2266,9 +2093,9 @@ impl From<PathPat> for Pat { | |||
2266 | Pat::PathPat(node) | 2093 | Pat::PathPat(node) |
2267 | } | 2094 | } |
2268 | } | 2095 | } |
2269 | impl From<StructPat> for Pat { | 2096 | impl From<RecordPat> for Pat { |
2270 | fn from(node: StructPat) -> Pat { | 2097 | fn from(node: RecordPat) -> Pat { |
2271 | Pat::StructPat(node) | 2098 | Pat::RecordPat(node) |
2272 | } | 2099 | } |
2273 | } | 2100 | } |
2274 | impl From<TupleStructPat> for Pat { | 2101 | impl From<TupleStructPat> for Pat { |
@@ -2299,7 +2126,7 @@ impl From<LiteralPat> for Pat { | |||
2299 | impl AstNode for Pat { | 2126 | impl AstNode for Pat { |
2300 | fn can_cast(kind: SyntaxKind) -> bool { | 2127 | fn can_cast(kind: SyntaxKind) -> bool { |
2301 | match kind { | 2128 | match kind { |
2302 | REF_PAT | BIND_PAT | PLACEHOLDER_PAT | PATH_PAT | STRUCT_PAT | TUPLE_STRUCT_PAT | 2129 | REF_PAT | BIND_PAT | PLACEHOLDER_PAT | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT |
2303 | | TUPLE_PAT | SLICE_PAT | RANGE_PAT | LITERAL_PAT => true, | 2130 | | TUPLE_PAT | SLICE_PAT | RANGE_PAT | LITERAL_PAT => true, |
2304 | _ => false, | 2131 | _ => false, |
2305 | } | 2132 | } |
@@ -2310,7 +2137,7 @@ impl AstNode for Pat { | |||
2310 | BIND_PAT => Pat::BindPat(BindPat { syntax }), | 2137 | BIND_PAT => Pat::BindPat(BindPat { syntax }), |
2311 | PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), | 2138 | PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), |
2312 | PATH_PAT => Pat::PathPat(PathPat { syntax }), | 2139 | PATH_PAT => Pat::PathPat(PathPat { syntax }), |
2313 | STRUCT_PAT => Pat::StructPat(StructPat { syntax }), | 2140 | RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), |
2314 | TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), | 2141 | TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), |
2315 | TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), | 2142 | TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), |
2316 | SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), | 2143 | SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), |
@@ -2326,7 +2153,7 @@ impl AstNode for Pat { | |||
2326 | Pat::BindPat(it) => &it.syntax, | 2153 | Pat::BindPat(it) => &it.syntax, |
2327 | Pat::PlaceholderPat(it) => &it.syntax, | 2154 | Pat::PlaceholderPat(it) => &it.syntax, |
2328 | Pat::PathPat(it) => &it.syntax, | 2155 | Pat::PathPat(it) => &it.syntax, |
2329 | Pat::StructPat(it) => &it.syntax, | 2156 | Pat::RecordPat(it) => &it.syntax, |
2330 | Pat::TupleStructPat(it) => &it.syntax, | 2157 | Pat::TupleStructPat(it) => &it.syntax, |
2331 | Pat::TuplePat(it) => &it.syntax, | 2158 | Pat::TuplePat(it) => &it.syntax, |
2332 | Pat::SlicePat(it) => &it.syntax, | 2159 | Pat::SlicePat(it) => &it.syntax, |
@@ -2551,13 +2378,13 @@ impl PointerType { | |||
2551 | } | 2378 | } |
2552 | } | 2379 | } |
2553 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2380 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2554 | pub struct PosFieldDef { | 2381 | pub struct PrefixExpr { |
2555 | pub(crate) syntax: SyntaxNode, | 2382 | pub(crate) syntax: SyntaxNode, |
2556 | } | 2383 | } |
2557 | impl AstNode for PosFieldDef { | 2384 | impl AstNode for PrefixExpr { |
2558 | fn can_cast(kind: SyntaxKind) -> bool { | 2385 | fn can_cast(kind: SyntaxKind) -> bool { |
2559 | match kind { | 2386 | match kind { |
2560 | POS_FIELD_DEF => true, | 2387 | PREFIX_EXPR => true, |
2561 | _ => false, | 2388 | _ => false, |
2562 | } | 2389 | } |
2563 | } | 2390 | } |
@@ -2572,21 +2399,19 @@ impl AstNode for PosFieldDef { | |||
2572 | &self.syntax | 2399 | &self.syntax |
2573 | } | 2400 | } |
2574 | } | 2401 | } |
2575 | impl ast::VisibilityOwner for PosFieldDef {} | 2402 | impl PrefixExpr { |
2576 | impl ast::AttrsOwner for PosFieldDef {} | 2403 | pub fn expr(&self) -> Option<Expr> { |
2577 | impl PosFieldDef { | ||
2578 | pub fn type_ref(&self) -> Option<TypeRef> { | ||
2579 | AstChildren::new(&self.syntax).next() | 2404 | AstChildren::new(&self.syntax).next() |
2580 | } | 2405 | } |
2581 | } | 2406 | } |
2582 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2407 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2583 | pub struct PosFieldDefList { | 2408 | pub struct RangeExpr { |
2584 | pub(crate) syntax: SyntaxNode, | 2409 | pub(crate) syntax: SyntaxNode, |
2585 | } | 2410 | } |
2586 | impl AstNode for PosFieldDefList { | 2411 | impl AstNode for RangeExpr { |
2587 | fn can_cast(kind: SyntaxKind) -> bool { | 2412 | fn can_cast(kind: SyntaxKind) -> bool { |
2588 | match kind { | 2413 | match kind { |
2589 | POS_FIELD_DEF_LIST => true, | 2414 | RANGE_EXPR => true, |
2590 | _ => false, | 2415 | _ => false, |
2591 | } | 2416 | } |
2592 | } | 2417 | } |
@@ -2601,19 +2426,38 @@ impl AstNode for PosFieldDefList { | |||
2601 | &self.syntax | 2426 | &self.syntax |
2602 | } | 2427 | } |
2603 | } | 2428 | } |
2604 | impl PosFieldDefList { | 2429 | impl RangeExpr {} |
2605 | pub fn fields(&self) -> AstChildren<PosFieldDef> { | 2430 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2606 | AstChildren::new(&self.syntax) | 2431 | pub struct RangePat { |
2432 | pub(crate) syntax: SyntaxNode, | ||
2433 | } | ||
2434 | impl AstNode for RangePat { | ||
2435 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2436 | match kind { | ||
2437 | RANGE_PAT => true, | ||
2438 | _ => false, | ||
2439 | } | ||
2440 | } | ||
2441 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2442 | if Self::can_cast(syntax.kind()) { | ||
2443 | Some(Self { syntax }) | ||
2444 | } else { | ||
2445 | None | ||
2446 | } | ||
2447 | } | ||
2448 | fn syntax(&self) -> &SyntaxNode { | ||
2449 | &self.syntax | ||
2607 | } | 2450 | } |
2608 | } | 2451 | } |
2452 | impl RangePat {} | ||
2609 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2453 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2610 | pub struct PrefixExpr { | 2454 | pub struct RecordField { |
2611 | pub(crate) syntax: SyntaxNode, | 2455 | pub(crate) syntax: SyntaxNode, |
2612 | } | 2456 | } |
2613 | impl AstNode for PrefixExpr { | 2457 | impl AstNode for RecordField { |
2614 | fn can_cast(kind: SyntaxKind) -> bool { | 2458 | fn can_cast(kind: SyntaxKind) -> bool { |
2615 | match kind { | 2459 | match kind { |
2616 | PREFIX_EXPR => true, | 2460 | RECORD_FIELD => true, |
2617 | _ => false, | 2461 | _ => false, |
2618 | } | 2462 | } |
2619 | } | 2463 | } |
@@ -2628,19 +2472,22 @@ impl AstNode for PrefixExpr { | |||
2628 | &self.syntax | 2472 | &self.syntax |
2629 | } | 2473 | } |
2630 | } | 2474 | } |
2631 | impl PrefixExpr { | 2475 | impl RecordField { |
2476 | pub fn name_ref(&self) -> Option<NameRef> { | ||
2477 | AstChildren::new(&self.syntax).next() | ||
2478 | } | ||
2632 | pub fn expr(&self) -> Option<Expr> { | 2479 | pub fn expr(&self) -> Option<Expr> { |
2633 | AstChildren::new(&self.syntax).next() | 2480 | AstChildren::new(&self.syntax).next() |
2634 | } | 2481 | } |
2635 | } | 2482 | } |
2636 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2483 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2637 | pub struct RangeExpr { | 2484 | pub struct RecordFieldDef { |
2638 | pub(crate) syntax: SyntaxNode, | 2485 | pub(crate) syntax: SyntaxNode, |
2639 | } | 2486 | } |
2640 | impl AstNode for RangeExpr { | 2487 | impl AstNode for RecordFieldDef { |
2641 | fn can_cast(kind: SyntaxKind) -> bool { | 2488 | fn can_cast(kind: SyntaxKind) -> bool { |
2642 | match kind { | 2489 | match kind { |
2643 | RANGE_EXPR => true, | 2490 | RECORD_FIELD_DEF => true, |
2644 | _ => false, | 2491 | _ => false, |
2645 | } | 2492 | } |
2646 | } | 2493 | } |
@@ -2655,15 +2502,20 @@ impl AstNode for RangeExpr { | |||
2655 | &self.syntax | 2502 | &self.syntax |
2656 | } | 2503 | } |
2657 | } | 2504 | } |
2658 | impl RangeExpr {} | 2505 | impl ast::VisibilityOwner for RecordFieldDef {} |
2506 | impl ast::NameOwner for RecordFieldDef {} | ||
2507 | impl ast::AttrsOwner for RecordFieldDef {} | ||
2508 | impl ast::DocCommentsOwner for RecordFieldDef {} | ||
2509 | impl ast::TypeAscriptionOwner for RecordFieldDef {} | ||
2510 | impl RecordFieldDef {} | ||
2659 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2511 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2660 | pub struct RangePat { | 2512 | pub struct RecordFieldDefList { |
2661 | pub(crate) syntax: SyntaxNode, | 2513 | pub(crate) syntax: SyntaxNode, |
2662 | } | 2514 | } |
2663 | impl AstNode for RangePat { | 2515 | impl AstNode for RecordFieldDefList { |
2664 | fn can_cast(kind: SyntaxKind) -> bool { | 2516 | fn can_cast(kind: SyntaxKind) -> bool { |
2665 | match kind { | 2517 | match kind { |
2666 | RANGE_PAT => true, | 2518 | RECORD_FIELD_DEF_LIST => true, |
2667 | _ => false, | 2519 | _ => false, |
2668 | } | 2520 | } |
2669 | } | 2521 | } |
@@ -2678,7 +2530,159 @@ impl AstNode for RangePat { | |||
2678 | &self.syntax | 2530 | &self.syntax |
2679 | } | 2531 | } |
2680 | } | 2532 | } |
2681 | impl RangePat {} | 2533 | impl RecordFieldDefList { |
2534 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { | ||
2535 | AstChildren::new(&self.syntax) | ||
2536 | } | ||
2537 | } | ||
2538 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2539 | pub struct RecordFieldList { | ||
2540 | pub(crate) syntax: SyntaxNode, | ||
2541 | } | ||
2542 | impl AstNode for RecordFieldList { | ||
2543 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2544 | match kind { | ||
2545 | RECORD_FIELD_LIST => true, | ||
2546 | _ => false, | ||
2547 | } | ||
2548 | } | ||
2549 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2550 | if Self::can_cast(syntax.kind()) { | ||
2551 | Some(Self { syntax }) | ||
2552 | } else { | ||
2553 | None | ||
2554 | } | ||
2555 | } | ||
2556 | fn syntax(&self) -> &SyntaxNode { | ||
2557 | &self.syntax | ||
2558 | } | ||
2559 | } | ||
2560 | impl RecordFieldList { | ||
2561 | pub fn fields(&self) -> AstChildren<RecordField> { | ||
2562 | AstChildren::new(&self.syntax) | ||
2563 | } | ||
2564 | pub fn spread(&self) -> Option<Expr> { | ||
2565 | AstChildren::new(&self.syntax).next() | ||
2566 | } | ||
2567 | } | ||
2568 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2569 | pub struct RecordFieldPat { | ||
2570 | pub(crate) syntax: SyntaxNode, | ||
2571 | } | ||
2572 | impl AstNode for RecordFieldPat { | ||
2573 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2574 | match kind { | ||
2575 | RECORD_FIELD_PAT => true, | ||
2576 | _ => false, | ||
2577 | } | ||
2578 | } | ||
2579 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2580 | if Self::can_cast(syntax.kind()) { | ||
2581 | Some(Self { syntax }) | ||
2582 | } else { | ||
2583 | None | ||
2584 | } | ||
2585 | } | ||
2586 | fn syntax(&self) -> &SyntaxNode { | ||
2587 | &self.syntax | ||
2588 | } | ||
2589 | } | ||
2590 | impl ast::NameOwner for RecordFieldPat {} | ||
2591 | impl RecordFieldPat { | ||
2592 | pub fn pat(&self) -> Option<Pat> { | ||
2593 | AstChildren::new(&self.syntax).next() | ||
2594 | } | ||
2595 | } | ||
2596 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2597 | pub struct RecordFieldPatList { | ||
2598 | pub(crate) syntax: SyntaxNode, | ||
2599 | } | ||
2600 | impl AstNode for RecordFieldPatList { | ||
2601 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2602 | match kind { | ||
2603 | RECORD_FIELD_PAT_LIST => true, | ||
2604 | _ => false, | ||
2605 | } | ||
2606 | } | ||
2607 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2608 | if Self::can_cast(syntax.kind()) { | ||
2609 | Some(Self { syntax }) | ||
2610 | } else { | ||
2611 | None | ||
2612 | } | ||
2613 | } | ||
2614 | fn syntax(&self) -> &SyntaxNode { | ||
2615 | &self.syntax | ||
2616 | } | ||
2617 | } | ||
2618 | impl RecordFieldPatList { | ||
2619 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { | ||
2620 | AstChildren::new(&self.syntax) | ||
2621 | } | ||
2622 | pub fn bind_pats(&self) -> AstChildren<BindPat> { | ||
2623 | AstChildren::new(&self.syntax) | ||
2624 | } | ||
2625 | } | ||
2626 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2627 | pub struct RecordLit { | ||
2628 | pub(crate) syntax: SyntaxNode, | ||
2629 | } | ||
2630 | impl AstNode for RecordLit { | ||
2631 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2632 | match kind { | ||
2633 | RECORD_LIT => true, | ||
2634 | _ => false, | ||
2635 | } | ||
2636 | } | ||
2637 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2638 | if Self::can_cast(syntax.kind()) { | ||
2639 | Some(Self { syntax }) | ||
2640 | } else { | ||
2641 | None | ||
2642 | } | ||
2643 | } | ||
2644 | fn syntax(&self) -> &SyntaxNode { | ||
2645 | &self.syntax | ||
2646 | } | ||
2647 | } | ||
2648 | impl RecordLit { | ||
2649 | pub fn path(&self) -> Option<Path> { | ||
2650 | AstChildren::new(&self.syntax).next() | ||
2651 | } | ||
2652 | pub fn record_field_list(&self) -> Option<RecordFieldList> { | ||
2653 | AstChildren::new(&self.syntax).next() | ||
2654 | } | ||
2655 | } | ||
2656 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2657 | pub struct RecordPat { | ||
2658 | pub(crate) syntax: SyntaxNode, | ||
2659 | } | ||
2660 | impl AstNode for RecordPat { | ||
2661 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2662 | match kind { | ||
2663 | RECORD_PAT => true, | ||
2664 | _ => false, | ||
2665 | } | ||
2666 | } | ||
2667 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2668 | if Self::can_cast(syntax.kind()) { | ||
2669 | Some(Self { syntax }) | ||
2670 | } else { | ||
2671 | None | ||
2672 | } | ||
2673 | } | ||
2674 | fn syntax(&self) -> &SyntaxNode { | ||
2675 | &self.syntax | ||
2676 | } | ||
2677 | } | ||
2678 | impl RecordPat { | ||
2679 | pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { | ||
2680 | AstChildren::new(&self.syntax).next() | ||
2681 | } | ||
2682 | pub fn path(&self) -> Option<Path> { | ||
2683 | AstChildren::new(&self.syntax).next() | ||
2684 | } | ||
2685 | } | ||
2682 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2686 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2683 | pub struct RefExpr { | 2687 | pub struct RefExpr { |
2684 | pub(crate) syntax: SyntaxNode, | 2688 | pub(crate) syntax: SyntaxNode, |
@@ -3018,13 +3022,13 @@ impl ast::AttrsOwner for StructDef {} | |||
3018 | impl ast::DocCommentsOwner for StructDef {} | 3022 | impl ast::DocCommentsOwner for StructDef {} |
3019 | impl StructDef {} | 3023 | impl StructDef {} |
3020 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3024 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3021 | pub struct StructLit { | 3025 | pub struct TokenTree { |
3022 | pub(crate) syntax: SyntaxNode, | 3026 | pub(crate) syntax: SyntaxNode, |
3023 | } | 3027 | } |
3024 | impl AstNode for StructLit { | 3028 | impl AstNode for TokenTree { |
3025 | fn can_cast(kind: SyntaxKind) -> bool { | 3029 | fn can_cast(kind: SyntaxKind) -> bool { |
3026 | match kind { | 3030 | match kind { |
3027 | STRUCT_LIT => true, | 3031 | TOKEN_TREE => true, |
3028 | _ => false, | 3032 | _ => false, |
3029 | } | 3033 | } |
3030 | } | 3034 | } |
@@ -3039,22 +3043,15 @@ impl AstNode for StructLit { | |||
3039 | &self.syntax | 3043 | &self.syntax |
3040 | } | 3044 | } |
3041 | } | 3045 | } |
3042 | impl StructLit { | 3046 | impl TokenTree {} |
3043 | pub fn path(&self) -> Option<Path> { | ||
3044 | AstChildren::new(&self.syntax).next() | ||
3045 | } | ||
3046 | pub fn named_field_list(&self) -> Option<NamedFieldList> { | ||
3047 | AstChildren::new(&self.syntax).next() | ||
3048 | } | ||
3049 | } | ||
3050 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3047 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3051 | pub struct StructPat { | 3048 | pub struct TraitDef { |
3052 | pub(crate) syntax: SyntaxNode, | 3049 | pub(crate) syntax: SyntaxNode, |
3053 | } | 3050 | } |
3054 | impl AstNode for StructPat { | 3051 | impl AstNode for TraitDef { |
3055 | fn can_cast(kind: SyntaxKind) -> bool { | 3052 | fn can_cast(kind: SyntaxKind) -> bool { |
3056 | match kind { | 3053 | match kind { |
3057 | STRUCT_PAT => true, | 3054 | TRAIT_DEF => true, |
3058 | _ => false, | 3055 | _ => false, |
3059 | } | 3056 | } |
3060 | } | 3057 | } |
@@ -3069,22 +3066,25 @@ impl AstNode for StructPat { | |||
3069 | &self.syntax | 3066 | &self.syntax |
3070 | } | 3067 | } |
3071 | } | 3068 | } |
3072 | impl StructPat { | 3069 | impl ast::VisibilityOwner for TraitDef {} |
3073 | pub fn field_pat_list(&self) -> Option<FieldPatList> { | 3070 | impl ast::NameOwner for TraitDef {} |
3074 | AstChildren::new(&self.syntax).next() | 3071 | impl ast::AttrsOwner for TraitDef {} |
3075 | } | 3072 | impl ast::DocCommentsOwner for TraitDef {} |
3076 | pub fn path(&self) -> Option<Path> { | 3073 | impl ast::TypeParamsOwner for TraitDef {} |
3074 | impl ast::TypeBoundsOwner for TraitDef {} | ||
3075 | impl TraitDef { | ||
3076 | pub fn item_list(&self) -> Option<ItemList> { | ||
3077 | AstChildren::new(&self.syntax).next() | 3077 | AstChildren::new(&self.syntax).next() |
3078 | } | 3078 | } |
3079 | } | 3079 | } |
3080 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3080 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3081 | pub struct TokenTree { | 3081 | pub struct TryBlockExpr { |
3082 | pub(crate) syntax: SyntaxNode, | 3082 | pub(crate) syntax: SyntaxNode, |
3083 | } | 3083 | } |
3084 | impl AstNode for TokenTree { | 3084 | impl AstNode for TryBlockExpr { |
3085 | fn can_cast(kind: SyntaxKind) -> bool { | 3085 | fn can_cast(kind: SyntaxKind) -> bool { |
3086 | match kind { | 3086 | match kind { |
3087 | TOKEN_TREE => true, | 3087 | TRY_BLOCK_EXPR => true, |
3088 | _ => false, | 3088 | _ => false, |
3089 | } | 3089 | } |
3090 | } | 3090 | } |
@@ -3099,15 +3099,16 @@ impl AstNode for TokenTree { | |||
3099 | &self.syntax | 3099 | &self.syntax |
3100 | } | 3100 | } |
3101 | } | 3101 | } |
3102 | impl TokenTree {} | 3102 | impl ast::TryBlockBodyOwner for TryBlockExpr {} |
3103 | impl TryBlockExpr {} | ||
3103 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3104 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3104 | pub struct TraitDef { | 3105 | pub struct TryExpr { |
3105 | pub(crate) syntax: SyntaxNode, | 3106 | pub(crate) syntax: SyntaxNode, |
3106 | } | 3107 | } |
3107 | impl AstNode for TraitDef { | 3108 | impl AstNode for TryExpr { |
3108 | fn can_cast(kind: SyntaxKind) -> bool { | 3109 | fn can_cast(kind: SyntaxKind) -> bool { |
3109 | match kind { | 3110 | match kind { |
3110 | TRAIT_DEF => true, | 3111 | TRY_EXPR => true, |
3111 | _ => false, | 3112 | _ => false, |
3112 | } | 3113 | } |
3113 | } | 3114 | } |
@@ -3122,25 +3123,19 @@ impl AstNode for TraitDef { | |||
3122 | &self.syntax | 3123 | &self.syntax |
3123 | } | 3124 | } |
3124 | } | 3125 | } |
3125 | impl ast::VisibilityOwner for TraitDef {} | 3126 | impl TryExpr { |
3126 | impl ast::NameOwner for TraitDef {} | 3127 | pub fn expr(&self) -> Option<Expr> { |
3127 | impl ast::AttrsOwner for TraitDef {} | ||
3128 | impl ast::DocCommentsOwner for TraitDef {} | ||
3129 | impl ast::TypeParamsOwner for TraitDef {} | ||
3130 | impl ast::TypeBoundsOwner for TraitDef {} | ||
3131 | impl TraitDef { | ||
3132 | pub fn item_list(&self) -> Option<ItemList> { | ||
3133 | AstChildren::new(&self.syntax).next() | 3128 | AstChildren::new(&self.syntax).next() |
3134 | } | 3129 | } |
3135 | } | 3130 | } |
3136 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3131 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3137 | pub struct TryBlockExpr { | 3132 | pub struct TupleExpr { |
3138 | pub(crate) syntax: SyntaxNode, | 3133 | pub(crate) syntax: SyntaxNode, |
3139 | } | 3134 | } |
3140 | impl AstNode for TryBlockExpr { | 3135 | impl AstNode for TupleExpr { |
3141 | fn can_cast(kind: SyntaxKind) -> bool { | 3136 | fn can_cast(kind: SyntaxKind) -> bool { |
3142 | match kind { | 3137 | match kind { |
3143 | TRY_BLOCK_EXPR => true, | 3138 | TUPLE_EXPR => true, |
3144 | _ => false, | 3139 | _ => false, |
3145 | } | 3140 | } |
3146 | } | 3141 | } |
@@ -3155,16 +3150,19 @@ impl AstNode for TryBlockExpr { | |||
3155 | &self.syntax | 3150 | &self.syntax |
3156 | } | 3151 | } |
3157 | } | 3152 | } |
3158 | impl ast::TryBlockBodyOwner for TryBlockExpr {} | 3153 | impl TupleExpr { |
3159 | impl TryBlockExpr {} | 3154 | pub fn exprs(&self) -> AstChildren<Expr> { |
3155 | AstChildren::new(&self.syntax) | ||
3156 | } | ||
3157 | } | ||
3160 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3158 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3161 | pub struct TryExpr { | 3159 | pub struct TupleFieldDef { |
3162 | pub(crate) syntax: SyntaxNode, | 3160 | pub(crate) syntax: SyntaxNode, |
3163 | } | 3161 | } |
3164 | impl AstNode for TryExpr { | 3162 | impl AstNode for TupleFieldDef { |
3165 | fn can_cast(kind: SyntaxKind) -> bool { | 3163 | fn can_cast(kind: SyntaxKind) -> bool { |
3166 | match kind { | 3164 | match kind { |
3167 | TRY_EXPR => true, | 3165 | TUPLE_FIELD_DEF => true, |
3168 | _ => false, | 3166 | _ => false, |
3169 | } | 3167 | } |
3170 | } | 3168 | } |
@@ -3179,19 +3177,21 @@ impl AstNode for TryExpr { | |||
3179 | &self.syntax | 3177 | &self.syntax |
3180 | } | 3178 | } |
3181 | } | 3179 | } |
3182 | impl TryExpr { | 3180 | impl ast::VisibilityOwner for TupleFieldDef {} |
3183 | pub fn expr(&self) -> Option<Expr> { | 3181 | impl ast::AttrsOwner for TupleFieldDef {} |
3182 | impl TupleFieldDef { | ||
3183 | pub fn type_ref(&self) -> Option<TypeRef> { | ||
3184 | AstChildren::new(&self.syntax).next() | 3184 | AstChildren::new(&self.syntax).next() |
3185 | } | 3185 | } |
3186 | } | 3186 | } |
3187 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3187 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3188 | pub struct TupleExpr { | 3188 | pub struct TupleFieldDefList { |
3189 | pub(crate) syntax: SyntaxNode, | 3189 | pub(crate) syntax: SyntaxNode, |
3190 | } | 3190 | } |
3191 | impl AstNode for TupleExpr { | 3191 | impl AstNode for TupleFieldDefList { |
3192 | fn can_cast(kind: SyntaxKind) -> bool { | 3192 | fn can_cast(kind: SyntaxKind) -> bool { |
3193 | match kind { | 3193 | match kind { |
3194 | TUPLE_EXPR => true, | 3194 | TUPLE_FIELD_DEF_LIST => true, |
3195 | _ => false, | 3195 | _ => false, |
3196 | } | 3196 | } |
3197 | } | 3197 | } |
@@ -3206,8 +3206,8 @@ impl AstNode for TupleExpr { | |||
3206 | &self.syntax | 3206 | &self.syntax |
3207 | } | 3207 | } |
3208 | } | 3208 | } |
3209 | impl TupleExpr { | 3209 | impl TupleFieldDefList { |
3210 | pub fn exprs(&self) -> AstChildren<Expr> { | 3210 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { |
3211 | AstChildren::new(&self.syntax) | 3211 | AstChildren::new(&self.syntax) |
3212 | } | 3212 | } |
3213 | } | 3213 | } |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 26efeeba9..4659192cd 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -161,9 +161,9 @@ Grammar( | |||
161 | "BIND_PAT", | 161 | "BIND_PAT", |
162 | "PLACEHOLDER_PAT", | 162 | "PLACEHOLDER_PAT", |
163 | "PATH_PAT", | 163 | "PATH_PAT", |
164 | "STRUCT_PAT", | 164 | "RECORD_PAT", |
165 | "FIELD_PAT_LIST", | 165 | "RECORD_FIELD_PAT_LIST", |
166 | "FIELD_PAT", | 166 | "RECORD_FIELD_PAT", |
167 | "TUPLE_STRUCT_PAT", | 167 | "TUPLE_STRUCT_PAT", |
168 | "TUPLE_PAT", | 168 | "TUPLE_PAT", |
169 | "SLICE_PAT", | 169 | "SLICE_PAT", |
@@ -190,9 +190,9 @@ Grammar( | |||
190 | "MATCH_ARM_LIST", | 190 | "MATCH_ARM_LIST", |
191 | "MATCH_ARM", | 191 | "MATCH_ARM", |
192 | "MATCH_GUARD", | 192 | "MATCH_GUARD", |
193 | "STRUCT_LIT", | 193 | "RECORD_LIT", |
194 | "NAMED_FIELD_LIST", | 194 | "RECORD_FIELD_LIST", |
195 | "NAMED_FIELD", | 195 | "RECORD_FIELD", |
196 | "TRY_BLOCK_EXPR", | 196 | "TRY_BLOCK_EXPR", |
197 | "BOX_EXPR", | 197 | "BOX_EXPR", |
198 | 198 | ||
@@ -216,10 +216,10 @@ Grammar( | |||
216 | "EXTERN_BLOCK", | 216 | "EXTERN_BLOCK", |
217 | "EXTERN_ITEM_LIST", | 217 | "EXTERN_ITEM_LIST", |
218 | "ENUM_VARIANT", | 218 | "ENUM_VARIANT", |
219 | "NAMED_FIELD_DEF_LIST", | 219 | "RECORD_FIELD_DEF_LIST", |
220 | "NAMED_FIELD_DEF", | 220 | "RECORD_FIELD_DEF", |
221 | "POS_FIELD_DEF_LIST", | 221 | "TUPLE_FIELD_DEF_LIST", |
222 | "POS_FIELD_DEF", | 222 | "TUPLE_FIELD_DEF", |
223 | "ENUM_VARIANT_LIST", | 223 | "ENUM_VARIANT_LIST", |
224 | "ITEM_LIST", | 224 | "ITEM_LIST", |
225 | "ATTR", | 225 | "ATTR", |
@@ -286,8 +286,8 @@ Grammar( | |||
286 | "DocCommentsOwner" | 286 | "DocCommentsOwner" |
287 | ] | 287 | ] |
288 | ), | 288 | ), |
289 | "NamedFieldDefList": (collections: [("fields", "NamedFieldDef")]), | 289 | "RecordFieldDefList": (collections: [("fields", "RecordFieldDef")]), |
290 | "NamedFieldDef": ( | 290 | "RecordFieldDef": ( |
291 | traits: [ | 291 | traits: [ |
292 | "VisibilityOwner", | 292 | "VisibilityOwner", |
293 | "NameOwner", | 293 | "NameOwner", |
@@ -296,8 +296,8 @@ Grammar( | |||
296 | "TypeAscriptionOwner" | 296 | "TypeAscriptionOwner" |
297 | ] | 297 | ] |
298 | ), | 298 | ), |
299 | "PosFieldDefList": (collections: [("fields", "PosFieldDef")]), | 299 | "TupleFieldDefList": (collections: [("fields", "TupleFieldDef")]), |
300 | "PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]), | 300 | "TupleFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]), |
301 | "EnumDef": ( traits: [ | 301 | "EnumDef": ( traits: [ |
302 | "VisibilityOwner", | 302 | "VisibilityOwner", |
303 | "NameOwner", | 303 | "NameOwner", |
@@ -461,12 +461,12 @@ Grammar( | |||
461 | traits: [ "AttrsOwner" ] | 461 | traits: [ "AttrsOwner" ] |
462 | ), | 462 | ), |
463 | "MatchGuard": (options: ["Expr"]), | 463 | "MatchGuard": (options: ["Expr"]), |
464 | "StructLit": (options: ["Path", "NamedFieldList"]), | 464 | "RecordLit": (options: ["Path", "RecordFieldList"]), |
465 | "NamedFieldList": ( | 465 | "RecordFieldList": ( |
466 | collections: [ ("fields", "NamedField") ], | 466 | collections: [ ("fields", "RecordField") ], |
467 | options: [["spread", "Expr"]] | 467 | options: [["spread", "Expr"]] |
468 | ), | 468 | ), |
469 | "NamedField": (options: ["NameRef", "Expr"]), | 469 | "RecordField": (options: ["NameRef", "Expr"]), |
470 | "CallExpr": ( | 470 | "CallExpr": ( |
471 | traits: ["ArgListOwner"], | 471 | traits: ["ArgListOwner"], |
472 | options: [ "Expr" ], | 472 | options: [ "Expr" ], |
@@ -504,7 +504,7 @@ Grammar( | |||
504 | "BlockExpr", | 504 | "BlockExpr", |
505 | "ReturnExpr", | 505 | "ReturnExpr", |
506 | "MatchExpr", | 506 | "MatchExpr", |
507 | "StructLit", | 507 | "RecordLit", |
508 | "CallExpr", | 508 | "CallExpr", |
509 | "IndexExpr", | 509 | "IndexExpr", |
510 | "MethodCallExpr", | 510 | "MethodCallExpr", |
@@ -529,14 +529,14 @@ Grammar( | |||
529 | ), | 529 | ), |
530 | "PlaceholderPat": (), | 530 | "PlaceholderPat": (), |
531 | "PathPat": ( options: [ "Path" ] ), | 531 | "PathPat": ( options: [ "Path" ] ), |
532 | "StructPat": ( options: ["FieldPatList", "Path"] ), | 532 | "RecordPat": ( options: ["RecordFieldPatList", "Path"] ), |
533 | "FieldPatList": ( | 533 | "RecordFieldPatList": ( |
534 | collections: [ | 534 | collections: [ |
535 | ("field_pats", "FieldPat"), | 535 | ("record_field_pats", "RecordFieldPat"), |
536 | ("bind_pats", "BindPat"), | 536 | ("bind_pats", "BindPat"), |
537 | ] | 537 | ] |
538 | ), | 538 | ), |
539 | "FieldPat": ( | 539 | "RecordFieldPat": ( |
540 | traits: ["NameOwner"], | 540 | traits: ["NameOwner"], |
541 | options: ["Pat"] | 541 | options: ["Pat"] |
542 | ), | 542 | ), |
@@ -555,7 +555,7 @@ Grammar( | |||
555 | "BindPat", | 555 | "BindPat", |
556 | "PlaceholderPat", | 556 | "PlaceholderPat", |
557 | "PathPat", | 557 | "PathPat", |
558 | "StructPat", | 558 | "RecordPat", |
559 | "TupleStructPat", | 559 | "TupleStructPat", |
560 | "TuplePat", | 560 | "TuplePat", |
561 | "SlicePat", | 561 | "SlicePat", |
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs index bf1b35c95..f59c559e9 100644 --- a/crates/ra_syntax/src/parsing/text_tree_sink.rs +++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs | |||
@@ -145,7 +145,7 @@ fn n_attached_trivias<'a>( | |||
145 | ) -> usize { | 145 | ) -> usize { |
146 | match kind { | 146 | match kind { |
147 | CONST_DEF | TYPE_ALIAS_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF | TRAIT_DEF | 147 | CONST_DEF | TYPE_ALIAS_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF | TRAIT_DEF |
148 | | MODULE | NAMED_FIELD_DEF => { | 148 | | MODULE | RECORD_FIELD_DEF => { |
149 | let mut res = 0; | 149 | let mut res = 0; |
150 | for (i, (kind, text)) in trivias.enumerate() { | 150 | for (i, (kind, text)) in trivias.enumerate() { |
151 | match kind { | 151 | match kind { |
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index 8665c8976..d24660ac3 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs | |||
@@ -80,7 +80,7 @@ fn test_local_syntax_ptr() { | |||
80 | use crate::{ast, AstNode, SourceFile}; | 80 | use crate::{ast, AstNode, SourceFile}; |
81 | 81 | ||
82 | let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap(); | 82 | let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap(); |
83 | let field = file.syntax().descendants().find_map(ast::NamedFieldDef::cast).unwrap(); | 83 | let field = file.syntax().descendants().find_map(ast::RecordFieldDef::cast).unwrap(); |
84 | let ptr = SyntaxNodePtr::new(field.syntax()); | 84 | let ptr = SyntaxNodePtr::new(field.syntax()); |
85 | let field_syntax = ptr.to_node(file.syntax()); | 85 | let field_syntax = ptr.to_node(file.syntax()); |
86 | assert_eq!(field.syntax(), &field_syntax); | 86 | assert_eq!(field.syntax(), &field_syntax); |
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index a8c789e0c..ee8797410 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs | |||
@@ -99,7 +99,7 @@ pub(crate) fn validate(root: &SyntaxNode) -> Vec<SyntaxError> { | |||
99 | .visit::<ast::Literal, _>(validate_literal) | 99 | .visit::<ast::Literal, _>(validate_literal) |
100 | .visit::<ast::Block, _>(block::validate_block_node) | 100 | .visit::<ast::Block, _>(block::validate_block_node) |
101 | .visit::<ast::FieldExpr, _>(|it, errors| validate_numeric_name(it.name_ref(), errors)) | 101 | .visit::<ast::FieldExpr, _>(|it, errors| validate_numeric_name(it.name_ref(), errors)) |
102 | .visit::<ast::NamedField, _>(|it, errors| validate_numeric_name(it.name_ref(), errors)) | 102 | .visit::<ast::RecordField, _>(|it, errors| validate_numeric_name(it.name_ref(), errors)) |
103 | .accept(&node); | 103 | .accept(&node); |
104 | } | 104 | } |
105 | errors | 105 | errors |
diff --git a/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.txt b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.txt index 0dbbfe853..dc143945a 100644 --- a/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.txt +++ b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.txt | |||
@@ -5,10 +5,10 @@ SOURCE_FILE@[0; 34) | |||
5 | NAME@[7; 8) | 5 | NAME@[7; 8) |
6 | IDENT@[7; 8) "S" | 6 | IDENT@[7; 8) "S" |
7 | WHITESPACE@[8; 9) " " | 7 | WHITESPACE@[8; 9) " " |
8 | NAMED_FIELD_DEF_LIST@[9; 34) | 8 | RECORD_FIELD_DEF_LIST@[9; 34) |
9 | L_CURLY@[9; 10) "{" | 9 | L_CURLY@[9; 10) "{" |
10 | WHITESPACE@[10; 15) "\n " | 10 | WHITESPACE@[10; 15) "\n " |
11 | NAMED_FIELD_DEF@[15; 21) | 11 | RECORD_FIELD_DEF@[15; 21) |
12 | NAME@[15; 16) | 12 | NAME@[15; 16) |
13 | IDENT@[15; 16) "a" | 13 | IDENT@[15; 16) "a" |
14 | COLON@[16; 17) ":" | 14 | COLON@[16; 17) ":" |
@@ -19,7 +19,7 @@ SOURCE_FILE@[0; 34) | |||
19 | NAME_REF@[18; 21) | 19 | NAME_REF@[18; 21) |
20 | IDENT@[18; 21) "u32" | 20 | IDENT@[18; 21) "u32" |
21 | WHITESPACE@[21; 26) "\n " | 21 | WHITESPACE@[21; 26) "\n " |
22 | NAMED_FIELD_DEF@[26; 32) | 22 | RECORD_FIELD_DEF@[26; 32) |
23 | NAME@[26; 27) | 23 | NAME@[26; 27) |
24 | IDENT@[26; 27) "b" | 24 | IDENT@[26; 27) "b" |
25 | COLON@[27; 28) ":" | 25 | COLON@[27; 28) ":" |
diff --git a/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.txt b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.txt index 7cfb54ef8..181bcdb9e 100644 --- a/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.txt +++ b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.txt | |||
@@ -11,7 +11,7 @@ SOURCE_FILE@[0; 21) | |||
11 | NAME@[17; 18) | 11 | NAME@[17; 18) |
12 | IDENT@[17; 18) "S" | 12 | IDENT@[17; 18) "S" |
13 | WHITESPACE@[18; 19) " " | 13 | WHITESPACE@[18; 19) " " |
14 | NAMED_FIELD_DEF_LIST@[19; 21) | 14 | RECORD_FIELD_DEF_LIST@[19; 21) |
15 | L_CURLY@[19; 20) "{" | 15 | L_CURLY@[19; 20) "{" |
16 | R_CURLY@[20; 21) "}" | 16 | R_CURLY@[20; 21) "}" |
17 | error 0: expected an item | 17 | error 0: expected an item |
diff --git a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.txt b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.txt index 857826037..58d005902 100644 --- a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.txt +++ b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.txt | |||
@@ -5,10 +5,10 @@ SOURCE_FILE@[0; 40) | |||
5 | NAME@[7; 8) | 5 | NAME@[7; 8) |
6 | IDENT@[7; 8) "S" | 6 | IDENT@[7; 8) "S" |
7 | WHITESPACE@[8; 9) " " | 7 | WHITESPACE@[8; 9) " " |
8 | NAMED_FIELD_DEF_LIST@[9; 39) | 8 | RECORD_FIELD_DEF_LIST@[9; 39) |
9 | L_CURLY@[9; 10) "{" | 9 | L_CURLY@[9; 10) "{" |
10 | WHITESPACE@[10; 15) "\n " | 10 | WHITESPACE@[10; 15) "\n " |
11 | NAMED_FIELD_DEF@[15; 21) | 11 | RECORD_FIELD_DEF@[15; 21) |
12 | NAME@[15; 16) | 12 | NAME@[15; 16) |
13 | IDENT@[15; 16) "a" | 13 | IDENT@[15; 16) "a" |
14 | COLON@[16; 17) ":" | 14 | COLON@[16; 17) ":" |
@@ -20,7 +20,7 @@ SOURCE_FILE@[0; 40) | |||
20 | IDENT@[18; 21) "i32" | 20 | IDENT@[18; 21) "i32" |
21 | COMMA@[21; 22) "," | 21 | COMMA@[21; 22) "," |
22 | WHITESPACE@[22; 27) "\n " | 22 | WHITESPACE@[22; 27) "\n " |
23 | NAMED_FIELD_DEF@[27; 36) | 23 | RECORD_FIELD_DEF@[27; 36) |
24 | NAME@[27; 28) | 24 | NAME@[27; 28) |
25 | IDENT@[27; 28) "b" | 25 | IDENT@[27; 28) "b" |
26 | COLON@[28; 29) ":" | 26 | COLON@[28; 29) ":" |
diff --git a/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.txt b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.txt index 6143e68f1..5f5198b31 100644 --- a/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.txt +++ b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.txt | |||
@@ -5,10 +5,10 @@ SOURCE_FILE@[0; 74) | |||
5 | NAME@[7; 8) | 5 | NAME@[7; 8) |
6 | IDENT@[7; 8) "S" | 6 | IDENT@[7; 8) "S" |
7 | WHITESPACE@[8; 9) " " | 7 | WHITESPACE@[8; 9) " " |
8 | NAMED_FIELD_DEF_LIST@[9; 73) | 8 | RECORD_FIELD_DEF_LIST@[9; 73) |
9 | L_CURLY@[9; 10) "{" | 9 | L_CURLY@[9; 10) "{" |
10 | WHITESPACE@[10; 15) "\n " | 10 | WHITESPACE@[10; 15) "\n " |
11 | NAMED_FIELD_DEF@[15; 21) | 11 | RECORD_FIELD_DEF@[15; 21) |
12 | NAME@[15; 16) | 12 | NAME@[15; 16) |
13 | IDENT@[15; 16) "f" | 13 | IDENT@[15; 16) "f" |
14 | COLON@[16; 17) ":" | 14 | COLON@[16; 17) ":" |
@@ -35,7 +35,7 @@ SOURCE_FILE@[0; 74) | |||
35 | ERROR@[42; 43) | 35 | ERROR@[42; 43) |
36 | STAR@[42; 43) "*" | 36 | STAR@[42; 43) "*" |
37 | WHITESPACE@[43; 48) "\n " | 37 | WHITESPACE@[43; 48) "\n " |
38 | NAMED_FIELD_DEF@[48; 58) | 38 | RECORD_FIELD_DEF@[48; 58) |
39 | VISIBILITY@[48; 51) | 39 | VISIBILITY@[48; 51) |
40 | PUB_KW@[48; 51) "pub" | 40 | PUB_KW@[48; 51) "pub" |
41 | WHITESPACE@[51; 52) " " | 41 | WHITESPACE@[51; 52) " " |
@@ -50,7 +50,7 @@ SOURCE_FILE@[0; 74) | |||
50 | IDENT@[55; 58) "u32" | 50 | IDENT@[55; 58) "u32" |
51 | COMMA@[58; 59) "," | 51 | COMMA@[58; 59) "," |
52 | WHITESPACE@[59; 64) "\n " | 52 | WHITESPACE@[59; 64) "\n " |
53 | NAMED_FIELD_DEF@[64; 70) | 53 | RECORD_FIELD_DEF@[64; 70) |
54 | NAME@[64; 65) | 54 | NAME@[64; 65) |
55 | IDENT@[64; 65) "z" | 55 | IDENT@[64; 65) "z" |
56 | COLON@[65; 66) ":" | 56 | COLON@[65; 66) ":" |
diff --git a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.txt b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.txt index bef286b37..4907bac6d 100644 --- a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.txt +++ b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.txt | |||
@@ -7,10 +7,10 @@ SOURCE_FILE@[0; 86) | |||
7 | WHITESPACE@[10; 11) " " | 7 | WHITESPACE@[10; 11) " " |
8 | NAME@[11; 16) | 8 | NAME@[11; 16) |
9 | IDENT@[11; 16) "Cache" | 9 | IDENT@[11; 16) "Cache" |
10 | POS_FIELD_DEF_LIST@[16; 72) | 10 | TUPLE_FIELD_DEF_LIST@[16; 72) |
11 | L_PAREN@[16; 17) "(" | 11 | L_PAREN@[16; 17) "(" |
12 | WHITESPACE@[17; 22) "\n " | 12 | WHITESPACE@[17; 22) "\n " |
13 | POS_FIELD_DEF@[22; 68) | 13 | TUPLE_FIELD_DEF@[22; 68) |
14 | PATH_TYPE@[22; 68) | 14 | PATH_TYPE@[22; 68) |
15 | PATH@[22; 68) | 15 | PATH@[22; 68) |
16 | PATH_SEGMENT@[22; 68) | 16 | PATH_SEGMENT@[22; 68) |
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 86) | |||
47 | ERROR@[67; 68) | 47 | ERROR@[67; 68) |
48 | AT@[67; 68) "@" | 48 | AT@[67; 68) "@" |
49 | WHITESPACE@[68; 69) " " | 49 | WHITESPACE@[68; 69) " " |
50 | POS_FIELD_DEF@[69; 72) | 50 | TUPLE_FIELD_DEF@[69; 72) |
51 | PATH_TYPE@[69; 72) | 51 | PATH_TYPE@[69; 72) |
52 | PATH@[69; 72) | 52 | PATH@[69; 72) |
53 | PATH_SEGMENT@[69; 72) | 53 | PATH_SEGMENT@[69; 72) |
diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt index 51def2d8f..52eb7d5e2 100644 --- a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt +++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt | |||
@@ -75,16 +75,16 @@ SOURCE_FILE@[0; 183) | |||
75 | IDENT@[106; 110) "push" | 75 | IDENT@[106; 110) "push" |
76 | ARG_LIST@[110; 155) | 76 | ARG_LIST@[110; 155) |
77 | L_PAREN@[110; 111) "(" | 77 | L_PAREN@[110; 111) "(" |
78 | STRUCT_LIT@[111; 154) | 78 | RECORD_LIT@[111; 154) |
79 | PATH@[111; 120) | 79 | PATH@[111; 120) |
80 | PATH_SEGMENT@[111; 120) | 80 | PATH_SEGMENT@[111; 120) |
81 | NAME_REF@[111; 120) | 81 | NAME_REF@[111; 120) |
82 | IDENT@[111; 120) "ScopeData" | 82 | IDENT@[111; 120) "ScopeData" |
83 | WHITESPACE@[120; 121) " " | 83 | WHITESPACE@[120; 121) " " |
84 | NAMED_FIELD_LIST@[121; 154) | 84 | RECORD_FIELD_LIST@[121; 154) |
85 | L_CURLY@[121; 122) "{" | 85 | L_CURLY@[121; 122) "{" |
86 | WHITESPACE@[122; 123) " " | 86 | WHITESPACE@[122; 123) " " |
87 | NAMED_FIELD@[123; 135) | 87 | RECORD_FIELD@[123; 135) |
88 | NAME_REF@[123; 129) | 88 | NAME_REF@[123; 129) |
89 | IDENT@[123; 129) "parent" | 89 | IDENT@[123; 129) "parent" |
90 | COLON@[129; 130) ":" | 90 | COLON@[129; 130) ":" |
@@ -96,7 +96,7 @@ SOURCE_FILE@[0; 183) | |||
96 | IDENT@[131; 135) "None" | 96 | IDENT@[131; 135) "None" |
97 | COMMA@[135; 136) "," | 97 | COMMA@[135; 136) "," |
98 | WHITESPACE@[136; 137) " " | 98 | WHITESPACE@[136; 137) " " |
99 | NAMED_FIELD@[137; 152) | 99 | RECORD_FIELD@[137; 152) |
100 | NAME_REF@[137; 144) | 100 | NAME_REF@[137; 144) |
101 | IDENT@[137; 144) "entries" | 101 | IDENT@[137; 144) "entries" |
102 | COLON@[144; 145) ":" | 102 | COLON@[144; 145) ":" |
diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.txt b/crates/ra_syntax/test_data/parser/err/0025_nope.txt index 0a3952dc9..7b228a8ed 100644 --- a/crates/ra_syntax/test_data/parser/err/0025_nope.txt +++ b/crates/ra_syntax/test_data/parser/err/0025_nope.txt | |||
@@ -28,9 +28,9 @@ SOURCE_FILE@[0; 575) | |||
28 | ENUM_VARIANT@[50; 62) | 28 | ENUM_VARIANT@[50; 62) |
29 | NAME@[50; 54) | 29 | NAME@[50; 54) |
30 | IDENT@[50; 54) "Var2" | 30 | IDENT@[50; 54) "Var2" |
31 | POS_FIELD_DEF_LIST@[54; 62) | 31 | TUPLE_FIELD_DEF_LIST@[54; 62) |
32 | L_PAREN@[54; 55) "(" | 32 | L_PAREN@[54; 55) "(" |
33 | POS_FIELD_DEF@[55; 61) | 33 | TUPLE_FIELD_DEF@[55; 61) |
34 | PATH_TYPE@[55; 61) | 34 | PATH_TYPE@[55; 61) |
35 | PATH@[55; 61) | 35 | PATH@[55; 61) |
36 | PATH_SEGMENT@[55; 61) | 36 | PATH_SEGMENT@[55; 61) |
@@ -43,10 +43,10 @@ SOURCE_FILE@[0; 575) | |||
43 | NAME@[72; 76) | 43 | NAME@[72; 76) |
44 | IDENT@[72; 76) "Var3" | 44 | IDENT@[72; 76) "Var3" |
45 | WHITESPACE@[76; 77) " " | 45 | WHITESPACE@[76; 77) " " |
46 | NAMED_FIELD_DEF_LIST@[77; 145) | 46 | RECORD_FIELD_DEF_LIST@[77; 145) |
47 | L_CURLY@[77; 78) "{" | 47 | L_CURLY@[77; 78) "{" |
48 | WHITESPACE@[78; 91) "\n " | 48 | WHITESPACE@[78; 91) "\n " |
49 | NAMED_FIELD_DEF@[91; 95) | 49 | RECORD_FIELD_DEF@[91; 95) |
50 | NAME@[91; 94) | 50 | NAME@[91; 94) |
51 | IDENT@[91; 94) "abc" | 51 | IDENT@[91; 94) "abc" |
52 | COLON@[94; 95) ":" | 52 | COLON@[94; 95) ":" |
@@ -108,10 +108,10 @@ SOURCE_FILE@[0; 575) | |||
108 | NAME@[250; 259) | 108 | NAME@[250; 259) |
109 | IDENT@[250; 259) "StillFine" | 109 | IDENT@[250; 259) "StillFine" |
110 | WHITESPACE@[259; 260) " " | 110 | WHITESPACE@[259; 260) " " |
111 | NAMED_FIELD_DEF_LIST@[260; 293) | 111 | RECORD_FIELD_DEF_LIST@[260; 293) |
112 | L_CURLY@[260; 261) "{" | 112 | L_CURLY@[260; 261) "{" |
113 | WHITESPACE@[261; 274) "\n " | 113 | WHITESPACE@[261; 274) "\n " |
114 | NAMED_FIELD_DEF@[274; 282) | 114 | RECORD_FIELD_DEF@[274; 282) |
115 | NAME@[274; 277) | 115 | NAME@[274; 277) |
116 | IDENT@[274; 277) "def" | 116 | IDENT@[274; 277) "def" |
117 | COLON@[277; 278) ":" | 117 | COLON@[277; 278) ":" |
@@ -147,9 +147,9 @@ SOURCE_FILE@[0; 575) | |||
147 | ENUM_VARIANT@[363; 372) | 147 | ENUM_VARIANT@[363; 372) |
148 | NAME@[363; 367) | 148 | NAME@[363; 367) |
149 | IDENT@[363; 367) "Nope" | 149 | IDENT@[363; 367) "Nope" |
150 | POS_FIELD_DEF_LIST@[367; 372) | 150 | TUPLE_FIELD_DEF_LIST@[367; 372) |
151 | L_PAREN@[367; 368) "(" | 151 | L_PAREN@[367; 368) "(" |
152 | POS_FIELD_DEF@[368; 371) | 152 | TUPLE_FIELD_DEF@[368; 371) |
153 | PATH_TYPE@[368; 371) | 153 | PATH_TYPE@[368; 371) |
154 | PATH@[368; 371) | 154 | PATH@[368; 371) |
155 | PATH_SEGMENT@[368; 371) | 155 | PATH_SEGMENT@[368; 371) |
diff --git a/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs b/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs index e0437d163..0e6e0ccc3 100644 --- a/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs +++ b/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs | |||
@@ -86,7 +86,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax | |||
86 | fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> { | 86 | fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> { |
87 | let res = match node.kind() { | 87 | let res = match node.kind() { |
88 | BLOCK => grammar::block, | 88 | BLOCK => grammar::block, |
89 | NAMED_FIELD_DEF_LIST => grammar::named_field_def_list, | 89 | RECORD_FIELD_DEF_LIST => grammar::record_field_def_list, |
90 | _ => return None, | 90 | _ => return None, |
91 | }; | 91 | }; |
92 | Some(res) | 92 | Some(res) |
@@ -138,7 +138,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax | |||
138 | let res = match node.kind() { | 138 | let res = match node.kind() { |
139 | ; | 139 | ; |
140 | let end = u32::from(range.end()) as usize; | 140 | let end = u32::from(range.end()) as usize; |
141 | text.replaT => grammar::named_field_def_list, | 141 | text.replaT => grammar::record_field_def_list, |
142 | _ => return None, | 142 | _ => return None, |
143 | }; | 143 | }; |
144 | Some(res) | 144 | Some(res) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.txt b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.txt index 0c6be485e..4108762e5 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.txt | |||
@@ -52,13 +52,13 @@ SOURCE_FILE@[0; 103) | |||
52 | LET_STMT@[58; 78) | 52 | LET_STMT@[58; 78) |
53 | LET_KW@[58; 61) "let" | 53 | LET_KW@[58; 61) "let" |
54 | WHITESPACE@[61; 62) " " | 54 | WHITESPACE@[61; 62) " " |
55 | STRUCT_PAT@[62; 72) | 55 | RECORD_PAT@[62; 72) |
56 | PATH@[62; 65) | 56 | PATH@[62; 65) |
57 | PATH_SEGMENT@[62; 65) | 57 | PATH_SEGMENT@[62; 65) |
58 | NAME_REF@[62; 65) | 58 | NAME_REF@[62; 65) |
59 | IDENT@[62; 65) "Bar" | 59 | IDENT@[62; 65) "Bar" |
60 | WHITESPACE@[65; 66) " " | 60 | WHITESPACE@[65; 66) " " |
61 | FIELD_PAT_LIST@[66; 72) | 61 | RECORD_FIELD_PAT_LIST@[66; 72) |
62 | L_CURLY@[66; 67) "{" | 62 | L_CURLY@[66; 67) "{" |
63 | WHITESPACE@[67; 68) " " | 63 | WHITESPACE@[67; 68) " " |
64 | DOTDOT@[68; 70) ".." | 64 | DOTDOT@[68; 70) ".." |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.txt b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.txt index fb8246174..882e4a9ae 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.txt | |||
@@ -22,10 +22,10 @@ SOURCE_FILE@[0; 71) | |||
22 | NAME@[27; 28) | 22 | NAME@[27; 28) |
23 | IDENT@[27; 28) "S" | 23 | IDENT@[27; 28) "S" |
24 | WHITESPACE@[28; 29) " " | 24 | WHITESPACE@[28; 29) " " |
25 | NAMED_FIELD_DEF_LIST@[29; 49) | 25 | RECORD_FIELD_DEF_LIST@[29; 49) |
26 | L_CURLY@[29; 30) "{" | 26 | L_CURLY@[29; 30) "{" |
27 | WHITESPACE@[30; 31) " " | 27 | WHITESPACE@[30; 31) " " |
28 | NAMED_FIELD_DEF@[31; 47) | 28 | RECORD_FIELD_DEF@[31; 47) |
29 | VISIBILITY@[31; 36) | 29 | VISIBILITY@[31; 36) |
30 | CRATE_KW@[31; 36) "crate" | 30 | CRATE_KW@[31; 36) "crate" |
31 | WHITESPACE@[36; 37) " " | 31 | WHITESPACE@[36; 37) " " |
@@ -46,9 +46,9 @@ SOURCE_FILE@[0; 71) | |||
46 | WHITESPACE@[56; 57) " " | 46 | WHITESPACE@[56; 57) " " |
47 | NAME@[57; 58) | 47 | NAME@[57; 58) |
48 | IDENT@[57; 58) "T" | 48 | IDENT@[57; 58) "T" |
49 | POS_FIELD_DEF_LIST@[58; 69) | 49 | TUPLE_FIELD_DEF_LIST@[58; 69) |
50 | L_PAREN@[58; 59) "(" | 50 | L_PAREN@[58; 59) "(" |
51 | POS_FIELD_DEF@[59; 68) | 51 | TUPLE_FIELD_DEF@[59; 68) |
52 | VISIBILITY@[59; 64) | 52 | VISIBILITY@[59; 64) |
53 | CRATE_KW@[59; 64) "crate" | 53 | CRATE_KW@[59; 64) "crate" |
54 | WHITESPACE@[64; 65) " " | 54 | WHITESPACE@[64; 65) " " |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0054_field_attrs.rs b/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rs index 4744d8ac0..4744d8ac0 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0054_field_attrs.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rs | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0054_field_attrs.txt b/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.txt index f214d1d47..56aeba768 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0054_field_attrs.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.txt | |||
@@ -5,10 +5,10 @@ SOURCE_FILE@[0; 64) | |||
5 | NAME@[7; 8) | 5 | NAME@[7; 8) |
6 | IDENT@[7; 8) "S" | 6 | IDENT@[7; 8) "S" |
7 | WHITESPACE@[8; 9) " " | 7 | WHITESPACE@[8; 9) " " |
8 | NAMED_FIELD_DEF_LIST@[9; 63) | 8 | RECORD_FIELD_DEF_LIST@[9; 63) |
9 | L_CURLY@[9; 10) "{" | 9 | L_CURLY@[9; 10) "{" |
10 | WHITESPACE@[10; 15) "\n " | 10 | WHITESPACE@[10; 15) "\n " |
11 | NAMED_FIELD_DEF@[15; 60) | 11 | RECORD_FIELD_DEF@[15; 60) |
12 | ATTR@[15; 43) | 12 | ATTR@[15; 43) |
13 | POUND@[15; 16) "#" | 13 | POUND@[15; 16) "#" |
14 | TOKEN_TREE@[16; 43) | 14 | TOKEN_TREE@[16; 43) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0061_struct_lit.rs b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rs index 6285e5549..6285e5549 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0061_struct_lit.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rs | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0061_struct_lit.txt b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.txt index d06594cae..1c915ea0c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0061_struct_lit.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.txt | |||
@@ -12,33 +12,33 @@ SOURCE_FILE@[0; 112) | |||
12 | L_CURLY@[9; 10) "{" | 12 | L_CURLY@[9; 10) "{" |
13 | WHITESPACE@[10; 15) "\n " | 13 | WHITESPACE@[10; 15) "\n " |
14 | EXPR_STMT@[15; 20) | 14 | EXPR_STMT@[15; 20) |
15 | STRUCT_LIT@[15; 19) | 15 | RECORD_LIT@[15; 19) |
16 | PATH@[15; 16) | 16 | PATH@[15; 16) |
17 | PATH_SEGMENT@[15; 16) | 17 | PATH_SEGMENT@[15; 16) |
18 | NAME_REF@[15; 16) | 18 | NAME_REF@[15; 16) |
19 | IDENT@[15; 16) "S" | 19 | IDENT@[15; 16) "S" |
20 | WHITESPACE@[16; 17) " " | 20 | WHITESPACE@[16; 17) " " |
21 | NAMED_FIELD_LIST@[17; 19) | 21 | RECORD_FIELD_LIST@[17; 19) |
22 | L_CURLY@[17; 18) "{" | 22 | L_CURLY@[17; 18) "{" |
23 | R_CURLY@[18; 19) "}" | 23 | R_CURLY@[18; 19) "}" |
24 | SEMI@[19; 20) ";" | 24 | SEMI@[19; 20) ";" |
25 | WHITESPACE@[20; 25) "\n " | 25 | WHITESPACE@[20; 25) "\n " |
26 | EXPR_STMT@[25; 41) | 26 | EXPR_STMT@[25; 41) |
27 | STRUCT_LIT@[25; 40) | 27 | RECORD_LIT@[25; 40) |
28 | PATH@[25; 26) | 28 | PATH@[25; 26) |
29 | PATH_SEGMENT@[25; 26) | 29 | PATH_SEGMENT@[25; 26) |
30 | NAME_REF@[25; 26) | 30 | NAME_REF@[25; 26) |
31 | IDENT@[25; 26) "S" | 31 | IDENT@[25; 26) "S" |
32 | WHITESPACE@[26; 27) " " | 32 | WHITESPACE@[26; 27) " " |
33 | NAMED_FIELD_LIST@[27; 40) | 33 | RECORD_FIELD_LIST@[27; 40) |
34 | L_CURLY@[27; 28) "{" | 34 | L_CURLY@[27; 28) "{" |
35 | WHITESPACE@[28; 29) " " | 35 | WHITESPACE@[28; 29) " " |
36 | NAMED_FIELD@[29; 30) | 36 | RECORD_FIELD@[29; 30) |
37 | NAME_REF@[29; 30) | 37 | NAME_REF@[29; 30) |
38 | IDENT@[29; 30) "x" | 38 | IDENT@[29; 30) "x" |
39 | COMMA@[30; 31) "," | 39 | COMMA@[30; 31) "," |
40 | WHITESPACE@[31; 32) " " | 40 | WHITESPACE@[31; 32) " " |
41 | NAMED_FIELD@[32; 37) | 41 | RECORD_FIELD@[32; 37) |
42 | NAME_REF@[32; 33) | 42 | NAME_REF@[32; 33) |
43 | IDENT@[32; 33) "y" | 43 | IDENT@[32; 33) "y" |
44 | COLON@[33; 34) ":" | 44 | COLON@[33; 34) ":" |
@@ -51,21 +51,21 @@ SOURCE_FILE@[0; 112) | |||
51 | SEMI@[40; 41) ";" | 51 | SEMI@[40; 41) ";" |
52 | WHITESPACE@[41; 46) "\n " | 52 | WHITESPACE@[41; 46) "\n " |
53 | EXPR_STMT@[46; 83) | 53 | EXPR_STMT@[46; 83) |
54 | STRUCT_LIT@[46; 82) | 54 | RECORD_LIT@[46; 82) |
55 | PATH@[46; 47) | 55 | PATH@[46; 47) |
56 | PATH_SEGMENT@[46; 47) | 56 | PATH_SEGMENT@[46; 47) |
57 | NAME_REF@[46; 47) | 57 | NAME_REF@[46; 47) |
58 | IDENT@[46; 47) "S" | 58 | IDENT@[46; 47) "S" |
59 | WHITESPACE@[47; 48) " " | 59 | WHITESPACE@[47; 48) " " |
60 | NAMED_FIELD_LIST@[48; 82) | 60 | RECORD_FIELD_LIST@[48; 82) |
61 | L_CURLY@[48; 49) "{" | 61 | L_CURLY@[48; 49) "{" |
62 | WHITESPACE@[49; 50) " " | 62 | WHITESPACE@[49; 50) " " |
63 | NAMED_FIELD@[50; 51) | 63 | RECORD_FIELD@[50; 51) |
64 | NAME_REF@[50; 51) | 64 | NAME_REF@[50; 51) |
65 | IDENT@[50; 51) "x" | 65 | IDENT@[50; 51) "x" |
66 | COMMA@[51; 52) "," | 66 | COMMA@[51; 52) "," |
67 | WHITESPACE@[52; 53) " " | 67 | WHITESPACE@[52; 53) " " |
68 | NAMED_FIELD@[53; 58) | 68 | RECORD_FIELD@[53; 58) |
69 | NAME_REF@[53; 54) | 69 | NAME_REF@[53; 54) |
70 | IDENT@[53; 54) "y" | 70 | IDENT@[53; 54) "y" |
71 | COLON@[54; 55) ":" | 71 | COLON@[54; 55) ":" |
@@ -94,16 +94,16 @@ SOURCE_FILE@[0; 112) | |||
94 | SEMI@[82; 83) ";" | 94 | SEMI@[82; 83) ";" |
95 | WHITESPACE@[83; 88) "\n " | 95 | WHITESPACE@[83; 88) "\n " |
96 | EXPR_STMT@[88; 109) | 96 | EXPR_STMT@[88; 109) |
97 | STRUCT_LIT@[88; 108) | 97 | RECORD_LIT@[88; 108) |
98 | PATH@[88; 99) | 98 | PATH@[88; 99) |
99 | PATH_SEGMENT@[88; 99) | 99 | PATH_SEGMENT@[88; 99) |
100 | NAME_REF@[88; 99) | 100 | NAME_REF@[88; 99) |
101 | IDENT@[88; 99) "TupleStruct" | 101 | IDENT@[88; 99) "TupleStruct" |
102 | WHITESPACE@[99; 100) " " | 102 | WHITESPACE@[99; 100) " " |
103 | NAMED_FIELD_LIST@[100; 108) | 103 | RECORD_FIELD_LIST@[100; 108) |
104 | L_CURLY@[100; 101) "{" | 104 | L_CURLY@[100; 101) "{" |
105 | WHITESPACE@[101; 102) " " | 105 | WHITESPACE@[101; 102) " " |
106 | NAMED_FIELD@[102; 106) | 106 | RECORD_FIELD@[102; 106) |
107 | NAME_REF@[102; 103) | 107 | NAME_REF@[102; 103) |
108 | INT_NUMBER@[102; 103) "0" | 108 | INT_NUMBER@[102; 103) "0" |
109 | COLON@[103; 104) ":" | 109 | COLON@[103; 104) ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt index 28d501459..35f023782 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt | |||
@@ -49,14 +49,14 @@ SOURCE_FILE@[0; 215) | |||
49 | WHITESPACE@[60; 61) " " | 49 | WHITESPACE@[60; 61) " " |
50 | R_ANGLE@[61; 62) ">" | 50 | R_ANGLE@[61; 62) ">" |
51 | WHITESPACE@[62; 63) " " | 51 | WHITESPACE@[62; 63) " " |
52 | STRUCT_LIT@[63; 77) | 52 | RECORD_LIT@[63; 77) |
53 | PATH@[63; 67) | 53 | PATH@[63; 67) |
54 | PATH_SEGMENT@[63; 67) | 54 | PATH_SEGMENT@[63; 67) |
55 | NAME_REF@[63; 67) | 55 | NAME_REF@[63; 67) |
56 | IDENT@[63; 67) "Test" | 56 | IDENT@[63; 67) "Test" |
57 | NAMED_FIELD_LIST@[67; 77) | 57 | RECORD_FIELD_LIST@[67; 77) |
58 | L_CURLY@[67; 68) "{" | 58 | L_CURLY@[67; 68) "{" |
59 | NAMED_FIELD@[68; 76) | 59 | RECORD_FIELD@[68; 76) |
60 | NAME_REF@[68; 73) | 60 | NAME_REF@[68; 73) |
61 | IDENT@[68; 73) "field" | 61 | IDENT@[68; 73) "field" |
62 | COLON@[73; 74) ":" | 62 | COLON@[73; 74) ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.txt b/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.txt index 4b653317b..f9ace02ee 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.txt | |||
@@ -5,7 +5,7 @@ SOURCE_FILE@[0; 51) | |||
5 | NAME@[6; 9) | 5 | NAME@[6; 9) |
6 | IDENT@[6; 9) "Foo" | 6 | IDENT@[6; 9) "Foo" |
7 | WHITESPACE@[9; 10) " " | 7 | WHITESPACE@[9; 10) " " |
8 | NAMED_FIELD_DEF_LIST@[10; 12) | 8 | RECORD_FIELD_DEF_LIST@[10; 12) |
9 | L_CURLY@[10; 11) "{" | 9 | L_CURLY@[10; 11) "{" |
10 | R_CURLY@[11; 12) "}" | 10 | R_CURLY@[11; 12) "}" |
11 | WHITESPACE@[12; 13) "\n" | 11 | WHITESPACE@[12; 13) "\n" |
@@ -15,10 +15,10 @@ SOURCE_FILE@[0; 51) | |||
15 | NAME@[19; 22) | 15 | NAME@[19; 22) |
16 | IDENT@[19; 22) "Foo" | 16 | IDENT@[19; 22) "Foo" |
17 | WHITESPACE@[22; 23) " " | 17 | WHITESPACE@[22; 23) " " |
18 | NAMED_FIELD_DEF_LIST@[23; 50) | 18 | RECORD_FIELD_DEF_LIST@[23; 50) |
19 | L_CURLY@[23; 24) "{" | 19 | L_CURLY@[23; 24) "{" |
20 | WHITESPACE@[24; 29) "\n " | 20 | WHITESPACE@[24; 29) "\n " |
21 | NAMED_FIELD_DEF@[29; 35) | 21 | RECORD_FIELD_DEF@[29; 35) |
22 | NAME@[29; 30) | 22 | NAME@[29; 30) |
23 | IDENT@[29; 30) "a" | 23 | IDENT@[29; 30) "a" |
24 | COLON@[30; 31) ":" | 24 | COLON@[30; 31) ":" |
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 51) | |||
30 | IDENT@[32; 35) "i32" | 30 | IDENT@[32; 35) "i32" |
31 | COMMA@[35; 36) "," | 31 | COMMA@[35; 36) "," |
32 | WHITESPACE@[36; 41) "\n " | 32 | WHITESPACE@[36; 41) "\n " |
33 | NAMED_FIELD_DEF@[41; 47) | 33 | RECORD_FIELD_DEF@[41; 47) |
34 | NAME@[41; 42) | 34 | NAME@[41; 42) |
35 | IDENT@[41; 42) "b" | 35 | IDENT@[41; 42) "b" |
36 | COLON@[42; 43) ":" | 36 | COLON@[42; 43) ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.txt b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.txt index 62d93512b..e909f2b78 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.txt | |||
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 106) | |||
12 | NAME@[19; 22) | 12 | NAME@[19; 22) |
13 | IDENT@[19; 22) "Foo" | 13 | IDENT@[19; 22) "Foo" |
14 | WHITESPACE@[22; 23) " " | 14 | WHITESPACE@[22; 23) " " |
15 | NAMED_FIELD_DEF_LIST@[23; 25) | 15 | RECORD_FIELD_DEF_LIST@[23; 25) |
16 | L_CURLY@[23; 24) "{" | 16 | L_CURLY@[23; 24) "{" |
17 | R_CURLY@[24; 25) "}" | 17 | R_CURLY@[24; 25) "}" |
18 | WHITESPACE@[25; 26) "\n" | 18 | WHITESPACE@[25; 26) "\n" |
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 106) | |||
21 | WHITESPACE@[32; 33) " " | 21 | WHITESPACE@[32; 33) " " |
22 | NAME@[33; 36) | 22 | NAME@[33; 36) |
23 | IDENT@[33; 36) "Foo" | 23 | IDENT@[33; 36) "Foo" |
24 | POS_FIELD_DEF_LIST@[36; 38) | 24 | TUPLE_FIELD_DEF_LIST@[36; 38) |
25 | L_PAREN@[36; 37) "(" | 25 | L_PAREN@[36; 37) "(" |
26 | R_PAREN@[37; 38) ")" | 26 | R_PAREN@[37; 38) ")" |
27 | SEMI@[38; 39) ";" | 27 | SEMI@[38; 39) ";" |
@@ -31,9 +31,9 @@ SOURCE_FILE@[0; 106) | |||
31 | WHITESPACE@[46; 47) " " | 31 | WHITESPACE@[46; 47) " " |
32 | NAME@[47; 50) | 32 | NAME@[47; 50) |
33 | IDENT@[47; 50) "Foo" | 33 | IDENT@[47; 50) "Foo" |
34 | POS_FIELD_DEF_LIST@[50; 65) | 34 | TUPLE_FIELD_DEF_LIST@[50; 65) |
35 | L_PAREN@[50; 51) "(" | 35 | L_PAREN@[50; 51) "(" |
36 | POS_FIELD_DEF@[51; 57) | 36 | TUPLE_FIELD_DEF@[51; 57) |
37 | PATH_TYPE@[51; 57) | 37 | PATH_TYPE@[51; 57) |
38 | PATH@[51; 57) | 38 | PATH@[51; 57) |
39 | PATH_SEGMENT@[51; 57) | 39 | PATH_SEGMENT@[51; 57) |
@@ -41,7 +41,7 @@ SOURCE_FILE@[0; 106) | |||
41 | IDENT@[51; 57) "String" | 41 | IDENT@[51; 57) "String" |
42 | COMMA@[57; 58) "," | 42 | COMMA@[57; 58) "," |
43 | WHITESPACE@[58; 59) " " | 43 | WHITESPACE@[58; 59) " " |
44 | POS_FIELD_DEF@[59; 64) | 44 | TUPLE_FIELD_DEF@[59; 64) |
45 | PATH_TYPE@[59; 64) | 45 | PATH_TYPE@[59; 64) |
46 | PATH@[59; 64) | 46 | PATH@[59; 64) |
47 | PATH_SEGMENT@[59; 64) | 47 | PATH_SEGMENT@[59; 64) |
@@ -56,10 +56,10 @@ SOURCE_FILE@[0; 106) | |||
56 | NAME@[74; 77) | 56 | NAME@[74; 77) |
57 | IDENT@[74; 77) "Foo" | 57 | IDENT@[74; 77) "Foo" |
58 | WHITESPACE@[77; 78) " " | 58 | WHITESPACE@[77; 78) " " |
59 | NAMED_FIELD_DEF_LIST@[78; 105) | 59 | RECORD_FIELD_DEF_LIST@[78; 105) |
60 | L_CURLY@[78; 79) "{" | 60 | L_CURLY@[78; 79) "{" |
61 | WHITESPACE@[79; 84) "\n " | 61 | WHITESPACE@[79; 84) "\n " |
62 | NAMED_FIELD_DEF@[84; 90) | 62 | RECORD_FIELD_DEF@[84; 90) |
63 | NAME@[84; 85) | 63 | NAME@[84; 85) |
64 | IDENT@[84; 85) "a" | 64 | IDENT@[84; 85) "a" |
65 | COLON@[85; 86) ":" | 65 | COLON@[85; 86) ":" |
@@ -71,7 +71,7 @@ SOURCE_FILE@[0; 106) | |||
71 | IDENT@[87; 90) "i32" | 71 | IDENT@[87; 90) "i32" |
72 | COMMA@[90; 91) "," | 72 | COMMA@[90; 91) "," |
73 | WHITESPACE@[91; 96) "\n " | 73 | WHITESPACE@[91; 96) "\n " |
74 | NAMED_FIELD_DEF@[96; 102) | 74 | RECORD_FIELD_DEF@[96; 102) |
75 | NAME@[96; 97) | 75 | NAME@[96; 97) |
76 | IDENT@[96; 97) "b" | 76 | IDENT@[96; 97) "b" |
77 | COLON@[97; 98) ":" | 77 | COLON@[97; 98) ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0102_field_pat_list.rs b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs index da3412fa8..da3412fa8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0102_field_pat_list.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0102_field_pat_list.txt b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.txt index a2af4fc60..22db72c12 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0102_field_pat_list.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.txt | |||
@@ -14,13 +14,13 @@ SOURCE_FILE@[0; 119) | |||
14 | LET_STMT@[15; 29) | 14 | LET_STMT@[15; 29) |
15 | LET_KW@[15; 18) "let" | 15 | LET_KW@[15; 18) "let" |
16 | WHITESPACE@[18; 19) " " | 16 | WHITESPACE@[18; 19) " " |
17 | STRUCT_PAT@[19; 23) | 17 | RECORD_PAT@[19; 23) |
18 | PATH@[19; 20) | 18 | PATH@[19; 20) |
19 | PATH_SEGMENT@[19; 20) | 19 | PATH_SEGMENT@[19; 20) |
20 | NAME_REF@[19; 20) | 20 | NAME_REF@[19; 20) |
21 | IDENT@[19; 20) "S" | 21 | IDENT@[19; 20) "S" |
22 | WHITESPACE@[20; 21) " " | 22 | WHITESPACE@[20; 21) " " |
23 | FIELD_PAT_LIST@[21; 23) | 23 | RECORD_FIELD_PAT_LIST@[21; 23) |
24 | L_CURLY@[21; 22) "{" | 24 | L_CURLY@[21; 22) "{" |
25 | R_CURLY@[22; 23) "}" | 25 | R_CURLY@[22; 23) "}" |
26 | WHITESPACE@[23; 24) " " | 26 | WHITESPACE@[23; 24) " " |
@@ -34,13 +34,13 @@ SOURCE_FILE@[0; 119) | |||
34 | LET_STMT@[34; 62) | 34 | LET_STMT@[34; 62) |
35 | LET_KW@[34; 37) "let" | 35 | LET_KW@[34; 37) "let" |
36 | WHITESPACE@[37; 38) " " | 36 | WHITESPACE@[37; 38) " " |
37 | STRUCT_PAT@[38; 56) | 37 | RECORD_PAT@[38; 56) |
38 | PATH@[38; 39) | 38 | PATH@[38; 39) |
39 | PATH_SEGMENT@[38; 39) | 39 | PATH_SEGMENT@[38; 39) |
40 | NAME_REF@[38; 39) | 40 | NAME_REF@[38; 39) |
41 | IDENT@[38; 39) "S" | 41 | IDENT@[38; 39) "S" |
42 | WHITESPACE@[39; 40) " " | 42 | WHITESPACE@[39; 40) " " |
43 | FIELD_PAT_LIST@[40; 56) | 43 | RECORD_FIELD_PAT_LIST@[40; 56) |
44 | L_CURLY@[40; 41) "{" | 44 | L_CURLY@[40; 41) "{" |
45 | WHITESPACE@[41; 42) " " | 45 | WHITESPACE@[41; 42) " " |
46 | BIND_PAT@[42; 43) | 46 | BIND_PAT@[42; 43) |
@@ -68,16 +68,16 @@ SOURCE_FILE@[0; 119) | |||
68 | LET_STMT@[67; 90) | 68 | LET_STMT@[67; 90) |
69 | LET_KW@[67; 70) "let" | 69 | LET_KW@[67; 70) "let" |
70 | WHITESPACE@[70; 71) " " | 70 | WHITESPACE@[70; 71) " " |
71 | STRUCT_PAT@[71; 84) | 71 | RECORD_PAT@[71; 84) |
72 | PATH@[71; 72) | 72 | PATH@[71; 72) |
73 | PATH_SEGMENT@[71; 72) | 73 | PATH_SEGMENT@[71; 72) |
74 | NAME_REF@[71; 72) | 74 | NAME_REF@[71; 72) |
75 | IDENT@[71; 72) "S" | 75 | IDENT@[71; 72) "S" |
76 | WHITESPACE@[72; 73) " " | 76 | WHITESPACE@[72; 73) " " |
77 | FIELD_PAT_LIST@[73; 84) | 77 | RECORD_FIELD_PAT_LIST@[73; 84) |
78 | L_CURLY@[73; 74) "{" | 78 | L_CURLY@[73; 74) "{" |
79 | WHITESPACE@[74; 75) " " | 79 | WHITESPACE@[74; 75) " " |
80 | FIELD_PAT@[75; 79) | 80 | RECORD_FIELD_PAT@[75; 79) |
81 | NAME@[75; 76) | 81 | NAME@[75; 76) |
82 | IDENT@[75; 76) "h" | 82 | IDENT@[75; 76) "h" |
83 | COLON@[76; 77) ":" | 83 | COLON@[76; 77) ":" |
@@ -99,16 +99,16 @@ SOURCE_FILE@[0; 119) | |||
99 | LET_STMT@[95; 116) | 99 | LET_STMT@[95; 116) |
100 | LET_KW@[95; 98) "let" | 100 | LET_KW@[95; 98) "let" |
101 | WHITESPACE@[98; 99) " " | 101 | WHITESPACE@[98; 99) " " |
102 | STRUCT_PAT@[99; 110) | 102 | RECORD_PAT@[99; 110) |
103 | PATH@[99; 100) | 103 | PATH@[99; 100) |
104 | PATH_SEGMENT@[99; 100) | 104 | PATH_SEGMENT@[99; 100) |
105 | NAME_REF@[99; 100) | 105 | NAME_REF@[99; 100) |
106 | IDENT@[99; 100) "S" | 106 | IDENT@[99; 100) "S" |
107 | WHITESPACE@[100; 101) " " | 107 | WHITESPACE@[100; 101) " " |
108 | FIELD_PAT_LIST@[101; 110) | 108 | RECORD_FIELD_PAT_LIST@[101; 110) |
109 | L_CURLY@[101; 102) "{" | 109 | L_CURLY@[101; 102) "{" |
110 | WHITESPACE@[102; 103) " " | 110 | WHITESPACE@[102; 103) " " |
111 | FIELD_PAT@[103; 107) | 111 | RECORD_FIELD_PAT@[103; 107) |
112 | NAME@[103; 104) | 112 | NAME@[103; 104) |
113 | IDENT@[103; 104) "h" | 113 | IDENT@[103; 104) "h" |
114 | COLON@[104; 105) ":" | 114 | COLON@[104; 105) ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.txt b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.txt index 8534592b9..f5de01405 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.txt | |||
@@ -10,9 +10,9 @@ SOURCE_FILE@[0; 53) | |||
10 | NAME@[12; 13) | 10 | NAME@[12; 13) |
11 | IDENT@[12; 13) "T" | 11 | IDENT@[12; 13) "T" |
12 | R_ANGLE@[13; 14) ">" | 12 | R_ANGLE@[13; 14) ">" |
13 | POS_FIELD_DEF_LIST@[14; 17) | 13 | TUPLE_FIELD_DEF_LIST@[14; 17) |
14 | L_PAREN@[14; 15) "(" | 14 | L_PAREN@[14; 15) "(" |
15 | POS_FIELD_DEF@[15; 16) | 15 | TUPLE_FIELD_DEF@[15; 16) |
16 | PATH_TYPE@[15; 16) | 16 | PATH_TYPE@[15; 16) |
17 | PATH@[15; 16) | 17 | PATH@[15; 16) |
18 | PATH_SEGMENT@[15; 16) | 18 | PATH_SEGMENT@[15; 16) |
@@ -51,9 +51,9 @@ SOURCE_FILE@[0; 53) | |||
51 | NAME@[46; 47) | 51 | NAME@[46; 47) |
52 | IDENT@[46; 47) "T" | 52 | IDENT@[46; 47) "T" |
53 | R_ANGLE@[47; 48) ">" | 53 | R_ANGLE@[47; 48) ">" |
54 | POS_FIELD_DEF_LIST@[48; 51) | 54 | TUPLE_FIELD_DEF_LIST@[48; 51) |
55 | L_PAREN@[48; 49) "(" | 55 | L_PAREN@[48; 49) "(" |
56 | POS_FIELD_DEF@[49; 50) | 56 | TUPLE_FIELD_DEF@[49; 50) |
57 | PATH_TYPE@[49; 50) | 57 | PATH_TYPE@[49; 50) |
58 | PATH@[49; 50) | 58 | PATH@[49; 50) |
59 | PATH_SEGMENT@[49; 50) | 59 | PATH_SEGMENT@[49; 50) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0115_pos_field_attrs.rs b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rs index 635b9ac21..635b9ac21 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0115_pos_field_attrs.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rs | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0115_pos_field_attrs.txt b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.txt index 6dd3a9b93..cb6d9f76d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0115_pos_field_attrs.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.txt | |||
@@ -5,10 +5,10 @@ SOURCE_FILE@[0; 60) | |||
5 | NAME@[7; 8) | 5 | NAME@[7; 8) |
6 | IDENT@[7; 8) "S" | 6 | IDENT@[7; 8) "S" |
7 | WHITESPACE@[8; 9) " " | 7 | WHITESPACE@[8; 9) " " |
8 | POS_FIELD_DEF_LIST@[9; 58) | 8 | TUPLE_FIELD_DEF_LIST@[9; 58) |
9 | L_PAREN@[9; 10) "(" | 9 | L_PAREN@[9; 10) "(" |
10 | WHITESPACE@[10; 15) "\n " | 10 | WHITESPACE@[10; 15) "\n " |
11 | POS_FIELD_DEF@[15; 55) | 11 | TUPLE_FIELD_DEF@[15; 55) |
12 | ATTR@[15; 43) | 12 | ATTR@[15; 43) |
13 | POUND@[15; 16) "#" | 13 | POUND@[15; 16) "#" |
14 | TOKEN_TREE@[16; 43) | 14 | TOKEN_TREE@[16; 43) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0125_struct_literal_field_with_attr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rs index a6c7760c7..a6c7760c7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0125_struct_literal_field_with_attr.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rs | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0125_struct_literal_field_with_attr.txt b/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.txt index f9c5ec124..8fdf3756f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0125_struct_literal_field_with_attr.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.txt | |||
@@ -11,16 +11,16 @@ SOURCE_FILE@[0; 46) | |||
11 | BLOCK@[10; 45) | 11 | BLOCK@[10; 45) |
12 | L_CURLY@[10; 11) "{" | 12 | L_CURLY@[10; 11) "{" |
13 | WHITESPACE@[11; 16) "\n " | 13 | WHITESPACE@[11; 16) "\n " |
14 | STRUCT_LIT@[16; 43) | 14 | RECORD_LIT@[16; 43) |
15 | PATH@[16; 17) | 15 | PATH@[16; 17) |
16 | PATH_SEGMENT@[16; 17) | 16 | PATH_SEGMENT@[16; 17) |
17 | NAME_REF@[16; 17) | 17 | NAME_REF@[16; 17) |
18 | IDENT@[16; 17) "S" | 18 | IDENT@[16; 17) "S" |
19 | WHITESPACE@[17; 18) " " | 19 | WHITESPACE@[17; 18) " " |
20 | NAMED_FIELD_LIST@[18; 43) | 20 | RECORD_FIELD_LIST@[18; 43) |
21 | L_CURLY@[18; 19) "{" | 21 | L_CURLY@[18; 19) "{" |
22 | WHITESPACE@[19; 20) " " | 22 | WHITESPACE@[19; 20) " " |
23 | NAMED_FIELD@[20; 41) | 23 | RECORD_FIELD@[20; 41) |
24 | ATTR@[20; 32) | 24 | ATTR@[20; 32) |
25 | POUND@[20; 21) "#" | 25 | POUND@[20; 21) "#" |
26 | TOKEN_TREE@[21; 32) | 26 | TOKEN_TREE@[21; 32) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.txt b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.txt index 50d3b5def..64cbf4632 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.txt | |||
@@ -53,7 +53,7 @@ SOURCE_FILE@[0; 111) | |||
53 | NAME@[103; 104) | 53 | NAME@[103; 104) |
54 | IDENT@[103; 104) "S" | 54 | IDENT@[103; 104) "S" |
55 | WHITESPACE@[104; 105) " " | 55 | WHITESPACE@[104; 105) " " |
56 | NAMED_FIELD_DEF_LIST@[105; 107) | 56 | RECORD_FIELD_DEF_LIST@[105; 107) |
57 | L_CURLY@[105; 106) "{" | 57 | L_CURLY@[105; 106) "{" |
58 | R_CURLY@[106; 107) "}" | 58 | R_CURLY@[106; 107) "}" |
59 | SEMI@[107; 108) ";" | 59 | SEMI@[107; 108) ";" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.txt b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.txt index 08128f365..c4db9da40 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.txt | |||
@@ -22,14 +22,14 @@ SOURCE_FILE@[0; 52) | |||
22 | WHITESPACE@[23; 24) " " | 22 | WHITESPACE@[23; 24) " " |
23 | EQ@[24; 25) "=" | 23 | EQ@[24; 25) "=" |
24 | WHITESPACE@[25; 26) " " | 24 | WHITESPACE@[25; 26) " " |
25 | STRUCT_LIT@[26; 33) | 25 | RECORD_LIT@[26; 33) |
26 | PATH@[26; 27) | 26 | PATH@[26; 27) |
27 | PATH_SEGMENT@[26; 27) | 27 | PATH_SEGMENT@[26; 27) |
28 | NAME_REF@[26; 27) | 28 | NAME_REF@[26; 27) |
29 | IDENT@[26; 27) "F" | 29 | IDENT@[26; 27) "F" |
30 | NAMED_FIELD_LIST@[27; 33) | 30 | RECORD_FIELD_LIST@[27; 33) |
31 | L_CURLY@[27; 28) "{" | 31 | L_CURLY@[27; 28) "{" |
32 | NAMED_FIELD@[28; 32) | 32 | RECORD_FIELD@[28; 32) |
33 | NAME_REF@[28; 29) | 33 | NAME_REF@[28; 29) |
34 | IDENT@[28; 29) "x" | 34 | IDENT@[28; 29) "x" |
35 | COLON@[29; 30) ":" | 35 | COLON@[29; 30) ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0001_struct_item.txt b/crates/ra_syntax/test_data/parser/ok/0001_struct_item.txt index c6653cf25..fdc2d6768 100644 --- a/crates/ra_syntax/test_data/parser/ok/0001_struct_item.txt +++ b/crates/ra_syntax/test_data/parser/ok/0001_struct_item.txt | |||
@@ -20,10 +20,10 @@ SOURCE_FILE@[0; 32) | |||
20 | IDENT@[12; 16) "Copy" | 20 | IDENT@[12; 16) "Copy" |
21 | R_ANGLE@[16; 17) ">" | 21 | R_ANGLE@[16; 17) ">" |
22 | WHITESPACE@[17; 18) " " | 22 | WHITESPACE@[17; 18) " " |
23 | NAMED_FIELD_DEF_LIST@[18; 31) | 23 | RECORD_FIELD_DEF_LIST@[18; 31) |
24 | L_CURLY@[18; 19) "{" | 24 | L_CURLY@[18; 19) "{" |
25 | WHITESPACE@[19; 24) "\n " | 25 | WHITESPACE@[19; 24) "\n " |
26 | NAMED_FIELD_DEF@[24; 28) | 26 | RECORD_FIELD_DEF@[24; 28) |
27 | NAME@[24; 25) | 27 | NAME@[24; 25) |
28 | IDENT@[24; 25) "f" | 28 | IDENT@[24; 25) "f" |
29 | COLON@[25; 26) ":" | 29 | COLON@[25; 26) ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.txt b/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.txt index d0565ea83..ef34702fd 100644 --- a/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.txt +++ b/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.txt | |||
@@ -5,10 +5,10 @@ SOURCE_FILE@[0; 25) | |||
5 | NAME@[7; 8) | 5 | NAME@[7; 8) |
6 | IDENT@[7; 8) "S" | 6 | IDENT@[7; 8) "S" |
7 | WHITESPACE@[8; 9) " " | 7 | WHITESPACE@[8; 9) " " |
8 | NAMED_FIELD_DEF_LIST@[9; 25) | 8 | RECORD_FIELD_DEF_LIST@[9; 25) |
9 | L_CURLY@[9; 10) "{" | 9 | L_CURLY@[9; 10) "{" |
10 | WHITESPACE@[10; 15) "\n " | 10 | WHITESPACE@[10; 15) "\n " |
11 | NAMED_FIELD_DEF@[15; 23) | 11 | RECORD_FIELD_DEF@[15; 23) |
12 | NAME@[15; 18) | 12 | NAME@[15; 18) |
13 | IDENT@[15; 18) "foo" | 13 | IDENT@[15; 18) "foo" |
14 | COLON@[18; 19) ":" | 14 | COLON@[18; 19) ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0008_mod_item.txt b/crates/ra_syntax/test_data/parser/ok/0008_mod_item.txt index 9152d6eb6..5c16d0be6 100644 --- a/crates/ra_syntax/test_data/parser/ok/0008_mod_item.txt +++ b/crates/ra_syntax/test_data/parser/ok/0008_mod_item.txt | |||
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 118) | |||
46 | NAME@[59; 60) | 46 | NAME@[59; 60) |
47 | IDENT@[59; 60) "S" | 47 | IDENT@[59; 60) "S" |
48 | WHITESPACE@[60; 61) " " | 48 | WHITESPACE@[60; 61) " " |
49 | NAMED_FIELD_DEF_LIST@[61; 63) | 49 | RECORD_FIELD_DEF_LIST@[61; 63) |
50 | L_CURLY@[61; 62) "{" | 50 | L_CURLY@[61; 62) "{" |
51 | R_CURLY@[62; 63) "}" | 51 | R_CURLY@[62; 63) "}" |
52 | WHITESPACE@[63; 64) "\n" | 52 | WHITESPACE@[63; 64) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.txt b/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.txt index ac44093e8..3fbd14d7b 100644 --- a/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.txt +++ b/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.txt | |||
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 97) | |||
12 | NAME@[17; 18) | 12 | NAME@[17; 18) |
13 | IDENT@[17; 18) "B" | 13 | IDENT@[17; 18) "B" |
14 | WHITESPACE@[18; 19) " " | 14 | WHITESPACE@[18; 19) " " |
15 | NAMED_FIELD_DEF_LIST@[19; 21) | 15 | RECORD_FIELD_DEF_LIST@[19; 21) |
16 | L_CURLY@[19; 20) "{" | 16 | L_CURLY@[19; 20) "{" |
17 | R_CURLY@[20; 21) "}" | 17 | R_CURLY@[20; 21) "}" |
18 | WHITESPACE@[21; 22) "\n" | 18 | WHITESPACE@[21; 22) "\n" |
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 97) | |||
21 | WHITESPACE@[28; 29) " " | 21 | WHITESPACE@[28; 29) " " |
22 | NAME@[29; 30) | 22 | NAME@[29; 30) |
23 | IDENT@[29; 30) "C" | 23 | IDENT@[29; 30) "C" |
24 | POS_FIELD_DEF_LIST@[30; 32) | 24 | TUPLE_FIELD_DEF_LIST@[30; 32) |
25 | L_PAREN@[30; 31) "(" | 25 | L_PAREN@[30; 31) "(" |
26 | R_PAREN@[31; 32) ")" | 26 | R_PAREN@[31; 32) ")" |
27 | SEMI@[32; 33) ";" | 27 | SEMI@[32; 33) ";" |
@@ -32,10 +32,10 @@ SOURCE_FILE@[0; 97) | |||
32 | NAME@[42; 43) | 32 | NAME@[42; 43) |
33 | IDENT@[42; 43) "D" | 33 | IDENT@[42; 43) "D" |
34 | WHITESPACE@[43; 44) " " | 34 | WHITESPACE@[43; 44) " " |
35 | NAMED_FIELD_DEF_LIST@[44; 74) | 35 | RECORD_FIELD_DEF_LIST@[44; 74) |
36 | L_CURLY@[44; 45) "{" | 36 | L_CURLY@[44; 45) "{" |
37 | WHITESPACE@[45; 50) "\n " | 37 | WHITESPACE@[45; 50) "\n " |
38 | NAMED_FIELD_DEF@[50; 56) | 38 | RECORD_FIELD_DEF@[50; 56) |
39 | NAME@[50; 51) | 39 | NAME@[50; 51) |
40 | IDENT@[50; 51) "a" | 40 | IDENT@[50; 51) "a" |
41 | COLON@[51; 52) ":" | 41 | COLON@[51; 52) ":" |
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 97) | |||
47 | IDENT@[53; 56) "u32" | 47 | IDENT@[53; 56) "u32" |
48 | COMMA@[56; 57) "," | 48 | COMMA@[56; 57) "," |
49 | WHITESPACE@[57; 62) "\n " | 49 | WHITESPACE@[57; 62) "\n " |
50 | NAMED_FIELD_DEF@[62; 72) | 50 | RECORD_FIELD_DEF@[62; 72) |
51 | VISIBILITY@[62; 65) | 51 | VISIBILITY@[62; 65) |
52 | PUB_KW@[62; 65) "pub" | 52 | PUB_KW@[62; 65) "pub" |
53 | WHITESPACE@[65; 66) " " | 53 | WHITESPACE@[65; 66) " " |
@@ -68,9 +68,9 @@ SOURCE_FILE@[0; 97) | |||
68 | WHITESPACE@[82; 83) " " | 68 | WHITESPACE@[82; 83) " " |
69 | NAME@[83; 84) | 69 | NAME@[83; 84) |
70 | IDENT@[83; 84) "E" | 70 | IDENT@[83; 84) "E" |
71 | POS_FIELD_DEF_LIST@[84; 95) | 71 | TUPLE_FIELD_DEF_LIST@[84; 95) |
72 | L_PAREN@[84; 85) "(" | 72 | L_PAREN@[84; 85) "(" |
73 | POS_FIELD_DEF@[85; 90) | 73 | TUPLE_FIELD_DEF@[85; 90) |
74 | VISIBILITY@[85; 88) | 74 | VISIBILITY@[85; 88) |
75 | PUB_KW@[85; 88) "pub" | 75 | PUB_KW@[85; 88) "pub" |
76 | WHITESPACE@[88; 89) " " | 76 | WHITESPACE@[88; 89) " " |
@@ -81,7 +81,7 @@ SOURCE_FILE@[0; 97) | |||
81 | IDENT@[89; 90) "x" | 81 | IDENT@[89; 90) "x" |
82 | COMMA@[90; 91) "," | 82 | COMMA@[90; 91) "," |
83 | WHITESPACE@[91; 92) " " | 83 | WHITESPACE@[91; 92) " " |
84 | POS_FIELD_DEF@[92; 93) | 84 | TUPLE_FIELD_DEF@[92; 93) |
85 | PATH_TYPE@[92; 93) | 85 | PATH_TYPE@[92; 93) |
86 | PATH@[92; 93) | 86 | PATH@[92; 93) |
87 | PATH_SEGMENT@[92; 93) | 87 | PATH_SEGMENT@[92; 93) |
diff --git a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.txt b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.txt index 3f06f20f9..1e4e58dd3 100644 --- a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.txt +++ b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.txt | |||
@@ -23,9 +23,9 @@ SOURCE_FILE@[0; 290) | |||
23 | NAME@[24; 25) | 23 | NAME@[24; 25) |
24 | IDENT@[24; 25) "T" | 24 | IDENT@[24; 25) "T" |
25 | R_ANGLE@[25; 26) ">" | 25 | R_ANGLE@[25; 26) ">" |
26 | POS_FIELD_DEF_LIST@[26; 31) | 26 | TUPLE_FIELD_DEF_LIST@[26; 31) |
27 | L_PAREN@[26; 27) "(" | 27 | L_PAREN@[26; 27) "(" |
28 | POS_FIELD_DEF@[27; 30) | 28 | TUPLE_FIELD_DEF@[27; 30) |
29 | PATH_TYPE@[27; 30) | 29 | PATH_TYPE@[27; 30) |
30 | PATH@[27; 30) | 30 | PATH@[27; 30) |
31 | PATH_SEGMENT@[27; 30) | 31 | PATH_SEGMENT@[27; 30) |
@@ -46,10 +46,10 @@ SOURCE_FILE@[0; 290) | |||
46 | IDENT@[43; 44) "T" | 46 | IDENT@[43; 44) "T" |
47 | R_ANGLE@[44; 45) ">" | 47 | R_ANGLE@[44; 45) ">" |
48 | WHITESPACE@[45; 46) " " | 48 | WHITESPACE@[45; 46) " " |
49 | NAMED_FIELD_DEF_LIST@[46; 56) | 49 | RECORD_FIELD_DEF_LIST@[46; 56) |
50 | L_CURLY@[46; 47) "{" | 50 | L_CURLY@[46; 47) "{" |
51 | WHITESPACE@[47; 48) " " | 51 | WHITESPACE@[47; 48) " " |
52 | NAMED_FIELD_DEF@[48; 54) | 52 | RECORD_FIELD_DEF@[48; 54) |
53 | NAME@[48; 49) | 53 | NAME@[48; 49) |
54 | IDENT@[48; 49) "u" | 54 | IDENT@[48; 49) "u" |
55 | COLON@[49; 50) ":" | 55 | COLON@[49; 50) ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0019_enums.txt b/crates/ra_syntax/test_data/parser/ok/0019_enums.txt index 37753a7d0..9d4a47a51 100644 --- a/crates/ra_syntax/test_data/parser/ok/0019_enums.txt +++ b/crates/ra_syntax/test_data/parser/ok/0019_enums.txt | |||
@@ -86,10 +86,10 @@ SOURCE_FILE@[0; 182) | |||
86 | NAME@[101; 102) | 86 | NAME@[101; 102) |
87 | IDENT@[101; 102) "C" | 87 | IDENT@[101; 102) "C" |
88 | WHITESPACE@[102; 103) " " | 88 | WHITESPACE@[102; 103) " " |
89 | NAMED_FIELD_DEF_LIST@[103; 146) | 89 | RECORD_FIELD_DEF_LIST@[103; 146) |
90 | L_CURLY@[103; 104) "{" | 90 | L_CURLY@[103; 104) "{" |
91 | WHITESPACE@[104; 113) "\n " | 91 | WHITESPACE@[104; 113) "\n " |
92 | NAMED_FIELD_DEF@[113; 119) | 92 | RECORD_FIELD_DEF@[113; 119) |
93 | NAME@[113; 114) | 93 | NAME@[113; 114) |
94 | IDENT@[113; 114) "a" | 94 | IDENT@[113; 114) "a" |
95 | COLON@[114; 115) ":" | 95 | COLON@[114; 115) ":" |
@@ -101,7 +101,7 @@ SOURCE_FILE@[0; 182) | |||
101 | IDENT@[116; 119) "u32" | 101 | IDENT@[116; 119) "u32" |
102 | COMMA@[119; 120) "," | 102 | COMMA@[119; 120) "," |
103 | WHITESPACE@[120; 129) "\n " | 103 | WHITESPACE@[120; 129) "\n " |
104 | NAMED_FIELD_DEF@[129; 139) | 104 | RECORD_FIELD_DEF@[129; 139) |
105 | VISIBILITY@[129; 132) | 105 | VISIBILITY@[129; 132) |
106 | PUB_KW@[129; 132) "pub" | 106 | PUB_KW@[129; 132) "pub" |
107 | WHITESPACE@[132; 133) " " | 107 | WHITESPACE@[132; 133) " " |
@@ -123,7 +123,7 @@ SOURCE_FILE@[0; 182) | |||
123 | NAME@[152; 153) | 123 | NAME@[152; 153) |
124 | IDENT@[152; 153) "F" | 124 | IDENT@[152; 153) "F" |
125 | WHITESPACE@[153; 154) " " | 125 | WHITESPACE@[153; 154) " " |
126 | NAMED_FIELD_DEF_LIST@[154; 156) | 126 | RECORD_FIELD_DEF_LIST@[154; 156) |
127 | L_CURLY@[154; 155) "{" | 127 | L_CURLY@[154; 155) "{" |
128 | R_CURLY@[155; 156) "}" | 128 | R_CURLY@[155; 156) "}" |
129 | COMMA@[156; 157) "," | 129 | COMMA@[156; 157) "," |
@@ -131,9 +131,9 @@ SOURCE_FILE@[0; 182) | |||
131 | ENUM_VARIANT@[162; 169) | 131 | ENUM_VARIANT@[162; 169) |
132 | NAME@[162; 163) | 132 | NAME@[162; 163) |
133 | IDENT@[162; 163) "D" | 133 | IDENT@[162; 163) "D" |
134 | POS_FIELD_DEF_LIST@[163; 169) | 134 | TUPLE_FIELD_DEF_LIST@[163; 169) |
135 | L_PAREN@[163; 164) "(" | 135 | L_PAREN@[163; 164) "(" |
136 | POS_FIELD_DEF@[164; 167) | 136 | TUPLE_FIELD_DEF@[164; 167) |
137 | PATH_TYPE@[164; 167) | 137 | PATH_TYPE@[164; 167) |
138 | PATH@[164; 167) | 138 | PATH@[164; 167) |
139 | PATH_SEGMENT@[164; 167) | 139 | PATH_SEGMENT@[164; 167) |
@@ -146,7 +146,7 @@ SOURCE_FILE@[0; 182) | |||
146 | ENUM_VARIANT@[175; 178) | 146 | ENUM_VARIANT@[175; 178) |
147 | NAME@[175; 176) | 147 | NAME@[175; 176) |
148 | IDENT@[175; 176) "E" | 148 | IDENT@[175; 176) "E" |
149 | POS_FIELD_DEF_LIST@[176; 178) | 149 | TUPLE_FIELD_DEF_LIST@[176; 178) |
150 | L_PAREN@[176; 177) "(" | 150 | L_PAREN@[176; 177) "(" |
151 | R_PAREN@[177; 178) ")" | 151 | R_PAREN@[177; 178) ")" |
152 | COMMA@[178; 179) "," | 152 | COMMA@[178; 179) "," |
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.txt b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.txt index c89b591e9..c13ebfe37 100644 --- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.txt +++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.txt | |||
@@ -1564,10 +1564,10 @@ SOURCE_FILE@[0; 3813) | |||
1564 | LIFETIME@[2863; 2869) "\'union" | 1564 | LIFETIME@[2863; 2869) "\'union" |
1565 | R_ANGLE@[2869; 2870) ">" | 1565 | R_ANGLE@[2869; 2870) ">" |
1566 | WHITESPACE@[2870; 2871) " " | 1566 | WHITESPACE@[2870; 2871) " " |
1567 | NAMED_FIELD_DEF_LIST@[2871; 2904) | 1567 | RECORD_FIELD_DEF_LIST@[2871; 2904) |
1568 | L_CURLY@[2871; 2872) "{" | 1568 | L_CURLY@[2871; 2872) "{" |
1569 | WHITESPACE@[2872; 2873) " " | 1569 | WHITESPACE@[2872; 2873) " " |
1570 | NAMED_FIELD_DEF@[2873; 2901) | 1570 | RECORD_FIELD_DEF@[2873; 2901) |
1571 | NAME@[2873; 2878) | 1571 | NAME@[2873; 2878) |
1572 | IDENT@[2873; 2878) "union" | 1572 | IDENT@[2873; 2878) "union" |
1573 | COLON@[2878; 2879) ":" | 1573 | COLON@[2878; 2879) ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.txt b/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.txt index 3c717555d..05f2c656f 100644 --- a/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.txt +++ b/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.txt | |||
@@ -5,10 +5,10 @@ SOURCE_FILE@[0; 27) | |||
5 | NAME@[7; 8) | 5 | NAME@[7; 8) |
6 | IDENT@[7; 8) "S" | 6 | IDENT@[7; 8) "S" |
7 | WHITESPACE@[8; 9) " " | 7 | WHITESPACE@[8; 9) " " |
8 | NAMED_FIELD_DEF_LIST@[9; 27) | 8 | RECORD_FIELD_DEF_LIST@[9; 27) |
9 | L_CURLY@[9; 10) "{" | 9 | L_CURLY@[9; 10) "{" |
10 | WHITESPACE@[10; 15) "\n " | 10 | WHITESPACE@[10; 15) "\n " |
11 | NAMED_FIELD_DEF@[15; 25) | 11 | RECORD_FIELD_DEF@[15; 25) |
12 | NAME@[15; 20) | 12 | NAME@[15; 20) |
13 | IDENT@[15; 20) "r#foo" | 13 | IDENT@[15; 20) "r#foo" |
14 | COLON@[20; 21) ":" | 14 | COLON@[20; 21) ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.txt b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.txt index ef47521bf..1f2456afa 100644 --- a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.txt +++ b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.txt | |||
@@ -7,10 +7,10 @@ SOURCE_FILE@[0; 160) | |||
7 | NAME@[69; 73) | 7 | NAME@[69; 73) |
8 | IDENT@[69; 73) "Repr" | 8 | IDENT@[69; 73) "Repr" |
9 | WHITESPACE@[73; 74) " " | 9 | WHITESPACE@[73; 74) " " |
10 | NAMED_FIELD_DEF_LIST@[74; 90) | 10 | RECORD_FIELD_DEF_LIST@[74; 90) |
11 | L_CURLY@[74; 75) "{" | 11 | L_CURLY@[74; 75) "{" |
12 | WHITESPACE@[75; 76) " " | 12 | WHITESPACE@[75; 76) " " |
13 | NAMED_FIELD_DEF@[76; 88) | 13 | RECORD_FIELD_DEF@[76; 88) |
14 | NAME@[76; 79) | 14 | NAME@[76; 79) |
15 | IDENT@[76; 79) "raw" | 15 | IDENT@[76; 79) "raw" |
16 | COLON@[79; 80) ":" | 16 | COLON@[79; 80) ":" |
@@ -46,16 +46,16 @@ SOURCE_FILE@[0; 160) | |||
46 | BIN_EXPR@[107; 135) | 46 | BIN_EXPR@[107; 135) |
47 | INDEX_EXPR@[107; 131) | 47 | INDEX_EXPR@[107; 131) |
48 | FIELD_EXPR@[107; 128) | 48 | FIELD_EXPR@[107; 128) |
49 | STRUCT_LIT@[107; 124) | 49 | RECORD_LIT@[107; 124) |
50 | PATH@[107; 111) | 50 | PATH@[107; 111) |
51 | PATH_SEGMENT@[107; 111) | 51 | PATH_SEGMENT@[107; 111) |
52 | NAME_REF@[107; 111) | 52 | NAME_REF@[107; 111) |
53 | IDENT@[107; 111) "Repr" | 53 | IDENT@[107; 111) "Repr" |
54 | WHITESPACE@[111; 112) " " | 54 | WHITESPACE@[111; 112) " " |
55 | NAMED_FIELD_LIST@[112; 124) | 55 | RECORD_FIELD_LIST@[112; 124) |
56 | L_CURLY@[112; 113) "{" | 56 | L_CURLY@[112; 113) "{" |
57 | WHITESPACE@[113; 114) " " | 57 | WHITESPACE@[113; 114) " " |
58 | NAMED_FIELD@[114; 122) | 58 | RECORD_FIELD@[114; 122) |
59 | NAME_REF@[114; 117) | 59 | NAME_REF@[114; 117) |
60 | IDENT@[114; 117) "raw" | 60 | IDENT@[114; 117) "raw" |
61 | COLON@[117; 118) ":" | 61 | COLON@[117; 118) ":" |
@@ -83,14 +83,14 @@ SOURCE_FILE@[0; 160) | |||
83 | WHITESPACE@[136; 141) "\n " | 83 | WHITESPACE@[136; 141) "\n " |
84 | EXPR_STMT@[141; 157) | 84 | EXPR_STMT@[141; 157) |
85 | CALL_EXPR@[141; 156) | 85 | CALL_EXPR@[141; 156) |
86 | STRUCT_LIT@[141; 154) | 86 | RECORD_LIT@[141; 154) |
87 | PATH@[141; 145) | 87 | PATH@[141; 145) |
88 | PATH_SEGMENT@[141; 145) | 88 | PATH_SEGMENT@[141; 145) |
89 | NAME_REF@[141; 145) | 89 | NAME_REF@[141; 145) |
90 | IDENT@[141; 145) "Repr" | 90 | IDENT@[141; 145) "Repr" |
91 | NAMED_FIELD_LIST@[145; 154) | 91 | RECORD_FIELD_LIST@[145; 154) |
92 | L_CURLY@[145; 146) "{" | 92 | L_CURLY@[145; 146) "{" |
93 | NAMED_FIELD@[146; 153) | 93 | RECORD_FIELD@[146; 153) |
94 | NAME_REF@[146; 149) | 94 | NAME_REF@[146; 149) |
95 | IDENT@[146; 149) "raw" | 95 | IDENT@[146; 149) "raw" |
96 | COLON@[149; 150) ":" | 96 | COLON@[149; 150) ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.txt b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.txt index 917b50ddf..136e2aae1 100644 --- a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.txt +++ b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.txt | |||
@@ -268,9 +268,9 @@ SOURCE_FILE@[0; 395) | |||
268 | ENUM_VARIANT@[356; 365) | 268 | ENUM_VARIANT@[356; 365) |
269 | NAME@[356; 357) | 269 | NAME@[356; 357) |
270 | IDENT@[356; 357) "B" | 270 | IDENT@[356; 357) "B" |
271 | POS_FIELD_DEF_LIST@[357; 365) | 271 | TUPLE_FIELD_DEF_LIST@[357; 365) |
272 | L_PAREN@[357; 358) "(" | 272 | L_PAREN@[357; 358) "(" |
273 | POS_FIELD_DEF@[358; 360) | 273 | TUPLE_FIELD_DEF@[358; 360) |
274 | PATH_TYPE@[358; 360) | 274 | PATH_TYPE@[358; 360) |
275 | PATH@[358; 360) | 275 | PATH@[358; 360) |
276 | PATH_SEGMENT@[358; 360) | 276 | PATH_SEGMENT@[358; 360) |
@@ -278,7 +278,7 @@ SOURCE_FILE@[0; 395) | |||
278 | IDENT@[358; 360) "i8" | 278 | IDENT@[358; 360) "i8" |
279 | COMMA@[360; 361) "," | 279 | COMMA@[360; 361) "," |
280 | WHITESPACE@[361; 362) " " | 280 | WHITESPACE@[361; 362) " " |
281 | POS_FIELD_DEF@[362; 364) | 281 | TUPLE_FIELD_DEF@[362; 364) |
282 | PATH_TYPE@[362; 364) | 282 | PATH_TYPE@[362; 364) |
283 | PATH@[362; 364) | 283 | PATH@[362; 364) |
284 | PATH_SEGMENT@[362; 364) | 284 | PATH_SEGMENT@[362; 364) |