From 6f8aa75329d0a4e588e58b8f22f7932bf3d3a706 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 16:21:30 +0200 Subject: Rename RecordLit -> RecordExpr --- .../src/handlers/change_return_type_to_result.rs | 2 +- crates/ra_assists/src/handlers/extract_variable.rs | 2 +- crates/ra_assists/src/handlers/fix_visibility.rs | 2 +- crates/ra_assists/src/handlers/reorder_fields.rs | 6 +-- crates/ra_hir/src/semantics.rs | 15 ++++--- crates/ra_hir/src/source_analyzer.rs | 8 ++-- crates/ra_hir_def/src/body.rs | 4 +- crates/ra_hir_def/src/body/lower.rs | 4 +- crates/ra_hir_expand/src/db.rs | 2 +- crates/ra_hir_ty/src/diagnostics.rs | 12 +++--- crates/ra_hir_ty/src/diagnostics/expr.rs | 4 +- crates/ra_ide/src/completion/completion_context.rs | 8 ++-- crates/ra_ide/src/diagnostics.rs | 6 +-- crates/ra_ide/src/extend_selection.rs | 2 +- crates/ra_ide/src/folding_ranges.rs | 2 +- crates/ra_ide/src/inlay_hints.rs | 2 +- crates/ra_ide_db/src/defs.rs | 2 +- crates/ra_ide_db/src/search.rs | 2 +- crates/ra_parser/src/grammar.rs | 2 +- crates/ra_parser/src/grammar/expressions.rs | 6 +-- crates/ra_parser/src/syntax_kind/generated.rs | 6 +-- crates/ra_ssr/src/matching.rs | 4 +- crates/ra_syntax/src/ast/edit.rs | 10 ++--- crates/ra_syntax/src/ast/expr_ext.rs | 6 +-- crates/ra_syntax/src/ast/generated/nodes.rs | 50 +++++++++++----------- crates/ra_syntax/src/ast/make.rs | 4 +- crates/ra_syntax/src/ast/node_ext.rs | 8 ++-- crates/ra_syntax/src/validation.rs | 2 +- .../test_data/parser/err/0018_incomplete_fn.rast | 8 ++-- ...14_record_literal_before_ellipsis_recovery.rast | 6 +-- .../parser/inline/ok/0061_record_lit.rast | 26 +++++------ .../test_data/parser/inline/ok/0066_match_arm.rast | 6 +-- .../parser/inline/ok/0071_match_expr.rast | 4 +- .../ok/0125_record_literal_field_with_attr.rast | 6 +-- .../inline/ok/0138_expression_after_block.rast | 6 +-- .../parser/ok/0043_complex_assignment.rast | 12 +++--- 36 files changed, 131 insertions(+), 126 deletions(-) (limited to 'crates') diff --git a/crates/ra_assists/src/handlers/change_return_type_to_result.rs b/crates/ra_assists/src/handlers/change_return_type_to_result.rs index 52e24af6c..12018fc6a 100644 --- a/crates/ra_assists/src/handlers/change_return_type_to_result.rs +++ b/crates/ra_assists/src/handlers/change_return_type_to_result.rs @@ -240,7 +240,7 @@ fn get_tail_expr_from_block(expr: &Expr) -> Option> { Expr::ParenExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), Expr::PathExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), Expr::Label(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), - Expr::RecordLit(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), + Expr::RecordExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), Expr::IndexExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), Expr::MethodCallExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), Expr::AwaitExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), diff --git a/crates/ra_assists/src/handlers/extract_variable.rs b/crates/ra_assists/src/handlers/extract_variable.rs index 098adf078..b925a2884 100644 --- a/crates/ra_assists/src/handlers/extract_variable.rs +++ b/crates/ra_assists/src/handlers/extract_variable.rs @@ -45,7 +45,7 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext) -> Option target, move |edit| { let field_shorthand = - match to_extract.syntax().parent().and_then(ast::RecordField::cast) { + match to_extract.syntax().parent().and_then(ast::RecordExprField::cast) { Some(field) => field.name_ref(), None => None, }; diff --git a/crates/ra_assists/src/handlers/fix_visibility.rs b/crates/ra_assists/src/handlers/fix_visibility.rs index 1d3ed3c6a..1aefa79cc 100644 --- a/crates/ra_assists/src/handlers/fix_visibility.rs +++ b/crates/ra_assists/src/handlers/fix_visibility.rs @@ -82,7 +82,7 @@ fn add_vis_to_referenced_module_def(acc: &mut Assists, ctx: &AssistContext) -> O } fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { - let record_field: ast::RecordField = ctx.find_node_at_offset()?; + let record_field: ast::RecordExprField = ctx.find_node_at_offset()?; let (record_field_def, _) = ctx.sema.resolve_record_field(&record_field)?; let current_module = ctx.sema.scope(record_field.syntax()).module()?; diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs index 2ac1c56cf..120250e79 100644 --- a/crates/ra_assists/src/handlers/reorder_fields.rs +++ b/crates/ra_assists/src/handlers/reorder_fields.rs @@ -23,7 +23,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; // ``` // pub(crate) fn reorder_fields(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { - reorder::(acc, ctx).or_else(|| reorder::(acc, ctx)) + reorder::(acc, ctx).or_else(|| reorder::(acc, ctx)) } fn reorder(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { @@ -56,7 +56,7 @@ fn reorder(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { fn get_fields_kind(node: &SyntaxNode) -> Vec { match node.kind() { - RECORD_LIT => vec![RECORD_FIELD], + RECORD_EXPR => vec![RECORD_EXPR_FIELD], RECORD_PAT => vec![RECORD_FIELD_PAT, BIND_PAT], _ => vec![], } @@ -65,7 +65,7 @@ fn get_fields_kind(node: &SyntaxNode) -> Vec { fn get_field_name(node: &SyntaxNode) -> String { let res = match_ast! { match node { - ast::RecordField(field) => field.field_name().map(|it| it.to_string()), + ast::RecordExprField(field) => field.field_name().map(|it| it.to_string()), ast::RecordFieldPat(field) => field.field_name().map(|it| it.to_string()), _ => None, } diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 054405966..a654c618f 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs @@ -209,7 +209,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { self.imp.resolve_field(field) } - pub fn resolve_record_field(&self, field: &ast::RecordField) -> Option<(Field, Option)> { + pub fn resolve_record_field( + &self, + field: &ast::RecordExprField, + ) -> Option<(Field, Option)> { self.imp.resolve_record_field(field) } @@ -225,7 +228,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { self.imp.resolve_path(path) } - pub fn resolve_variant(&self, record_lit: ast::RecordLit) -> Option { + pub fn resolve_variant(&self, record_lit: ast::RecordExpr) -> Option { self.imp.resolve_variant(record_lit).map(VariantDef::from) } @@ -240,7 +243,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { // FIXME: use this instead? // pub fn resolve_name_ref(&self, name_ref: &ast::NameRef) -> Option; - pub fn record_literal_missing_fields(&self, literal: &ast::RecordLit) -> Vec<(Field, Type)> { + pub fn record_literal_missing_fields(&self, literal: &ast::RecordExpr) -> Vec<(Field, Type)> { self.imp.record_literal_missing_fields(literal) } @@ -422,7 +425,7 @@ impl<'db> SemanticsImpl<'db> { self.analyze(field.syntax()).resolve_field(self.db, field) } - fn resolve_record_field(&self, field: &ast::RecordField) -> Option<(Field, Option)> { + fn resolve_record_field(&self, field: &ast::RecordExprField) -> Option<(Field, Option)> { self.analyze(field.syntax()).resolve_record_field(self.db, field) } @@ -440,7 +443,7 @@ impl<'db> SemanticsImpl<'db> { self.analyze(path.syntax()).resolve_path(self.db, path) } - fn resolve_variant(&self, record_lit: ast::RecordLit) -> Option { + fn resolve_variant(&self, record_lit: ast::RecordExpr) -> Option { self.analyze(record_lit.syntax()).resolve_variant(self.db, record_lit) } @@ -453,7 +456,7 @@ impl<'db> SemanticsImpl<'db> { self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat) } - fn record_literal_missing_fields(&self, literal: &ast::RecordLit) -> Vec<(Field, Type)> { + fn record_literal_missing_fields(&self, literal: &ast::RecordExpr) -> Vec<(Field, Type)> { self.analyze(literal.syntax()) .record_literal_missing_fields(self.db, literal) .unwrap_or_default() diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs index 86a47a9e5..8f438bba0 100644 --- a/crates/ra_hir/src/source_analyzer.rs +++ b/crates/ra_hir/src/source_analyzer.rs @@ -159,7 +159,7 @@ impl SourceAnalyzer { pub(crate) fn resolve_record_field( &self, db: &dyn HirDatabase, - field: &ast::RecordField, + field: &ast::RecordExprField, ) -> Option<(Field, Option)> { let expr = field.expr()?; let expr_id = self.expr_id(db, &expr)?; @@ -246,7 +246,7 @@ impl SourceAnalyzer { } } - if let Some(rec_lit) = path.syntax().parent().and_then(ast::RecordLit::cast) { + if let Some(rec_lit) = path.syntax().parent().and_then(ast::RecordExpr::cast) { let expr_id = self.expr_id(db, &rec_lit.into())?; if let Some(VariantId::EnumVariantId(variant)) = self.infer.as_ref()?.variant_resolution_for_expr(expr_id) @@ -284,7 +284,7 @@ impl SourceAnalyzer { pub(crate) fn record_literal_missing_fields( &self, db: &dyn HirDatabase, - literal: &ast::RecordLit, + literal: &ast::RecordExpr, ) -> Option> { let krate = self.resolver.krate()?; let body = self.body.as_ref()?; @@ -358,7 +358,7 @@ impl SourceAnalyzer { pub(crate) fn resolve_variant( &self, db: &dyn HirDatabase, - record_lit: ast::RecordLit, + record_lit: ast::RecordExpr, ) -> Option { let infer = self.infer.as_ref()?; let expr_id = self.expr_id(db, &record_lit.into())?; diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index 2fe04db2b..d5f18b920 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs @@ -216,7 +216,7 @@ pub struct BodySourceMap { expr_map_back: ArenaMap>, pat_map: FxHashMap, pat_map_back: ArenaMap>, - field_map: FxHashMap<(ExprId, usize), InFile>>, + field_map: FxHashMap<(ExprId, usize), InFile>>, expansions: FxHashMap>, HirFileId>, } @@ -314,7 +314,7 @@ impl BodySourceMap { self.pat_map.get(&src).cloned() } - pub fn field_syntax(&self, expr: ExprId, field: usize) -> InFile> { + pub fn field_syntax(&self, expr: ExprId, field: usize) -> InFile> { self.field_map[&(expr, field)].clone() } } diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index f463997e7..576342af9 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -379,10 +379,10 @@ impl ExprCollector<'_> { let expr = e.expr().map(|e| self.collect_expr(e)); self.alloc_expr(Expr::Return { expr }, syntax_ptr) } - ast::Expr::RecordLit(e) => { + ast::Expr::RecordExpr(e) => { let path = e.path().and_then(|path| self.expander.parse_path(path)); let mut field_ptrs = Vec::new(); - let record_lit = if let Some(nfl) = e.record_field_list() { + let record_lit = if let Some(nfl) = e.record_expr_field_list() { let fields = nfl .fields() .inspect(|field| field_ptrs.push(AstPtr::new(field))) diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index e0ad1567f..41df66696 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs @@ -386,7 +386,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind { MATCH_EXPR => FragmentKind::Expr, MATCH_ARM => FragmentKind::Expr, MATCH_GUARD => FragmentKind::Expr, - RECORD_FIELD => FragmentKind::Expr, + RECORD_EXPR_FIELD => FragmentKind::Expr, CALL_EXPR => FragmentKind::Expr, INDEX_EXPR => FragmentKind::Expr, METHOD_CALL_EXPR => FragmentKind::Expr, diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs index 885abbaf2..f210c305a 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/ra_hir_ty/src/diagnostics.rs @@ -29,7 +29,7 @@ pub fn validate_body(db: &dyn HirDatabase, owner: DefWithBodyId, sink: &mut Diag #[derive(Debug)] pub struct NoSuchField { pub file: HirFileId, - pub field: AstPtr, + pub field: AstPtr, } impl Diagnostic for NoSuchField { @@ -47,19 +47,19 @@ impl Diagnostic for NoSuchField { } impl AstDiagnostic for NoSuchField { - type AST = ast::RecordField; + type AST = ast::RecordExprField; fn ast(&self, db: &dyn AstDatabase) -> Self::AST { let root = db.parse_or_expand(self.source().file_id).unwrap(); let node = self.source().value.to_node(&root); - ast::RecordField::cast(node).unwrap() + ast::RecordExprField::cast(node).unwrap() } } #[derive(Debug)] pub struct MissingFields { pub file: HirFileId, - pub field_list: AstPtr, + pub field_list: AstPtr, pub missed_fields: Vec, } @@ -80,12 +80,12 @@ impl Diagnostic for MissingFields { } impl AstDiagnostic for MissingFields { - type AST = ast::RecordFieldList; + type AST = ast::RecordExprFieldList; fn ast(&self, db: &dyn AstDatabase) -> Self::AST { let root = db.parse_or_expand(self.source().file_id).unwrap(); let node = self.source().value.to_node(&root); - ast::RecordFieldList::cast(node).unwrap() + ast::RecordExprFieldList::cast(node).unwrap() } } diff --git a/crates/ra_hir_ty/src/diagnostics/expr.rs b/crates/ra_hir_ty/src/diagnostics/expr.rs index fd930eab1..f0e0f2988 100644 --- a/crates/ra_hir_ty/src/diagnostics/expr.rs +++ b/crates/ra_hir_ty/src/diagnostics/expr.rs @@ -100,8 +100,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { if let Ok(source_ptr) = source_map.expr_syntax(id) { let root = source_ptr.file_syntax(db.upcast()); - if let ast::Expr::RecordLit(record_lit) = &source_ptr.value.to_node(&root) { - if let Some(field_list) = record_lit.record_field_list() { + if let ast::Expr::RecordExpr(record_lit) = &source_ptr.value.to_node(&root) { + if let Some(field_list) = record_lit.record_expr_field_list() { let variant_data = variant_data(db.upcast(), variant_def); let missed_fields = missed_fields .into_iter() diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 221d7847e..c8704eb3e 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs @@ -37,9 +37,9 @@ pub(crate) struct CompletionContext<'a> { pub(super) name_ref_syntax: Option, pub(super) function_syntax: Option, pub(super) use_item_syntax: Option, - pub(super) record_lit_syntax: Option, + pub(super) record_lit_syntax: Option, pub(super) record_pat_syntax: Option, - pub(super) record_field_syntax: Option, + pub(super) record_field_syntax: Option, pub(super) impl_def: Option, /// FIXME: `ActiveParameter` is string-based, which is very very wrong pub(super) active_parameter: Option, @@ -316,7 +316,7 @@ impl<'a> CompletionContext<'a> { self.name_ref_syntax = find_node_at_offset(&original_file, name_ref.syntax().text_range().start()); let name_range = name_ref.syntax().text_range(); - if ast::RecordField::for_field_name(&name_ref).is_some() { + if ast::RecordExprField::for_field_name(&name_ref).is_some() { self.record_lit_syntax = self.sema.find_node_at_offset_with_macros(&original_file, offset); } @@ -357,7 +357,7 @@ impl<'a> CompletionContext<'a> { .take_while(|it| { it.kind() != SOURCE_FILE && it.kind() != MODULE && it.kind() != CALL_EXPR }) - .find_map(ast::RecordField::cast); + .find_map(ast::RecordExprField::cast); let parent = match name_ref.syntax().parent() { Some(it) => it, diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 897177d05..efbb00d6d 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -146,7 +146,7 @@ fn missing_struct_field_fix( ) -> Option { let record_expr = sema.ast(d); - let record_lit = ast::RecordLit::cast(record_expr.syntax().parent()?.parent()?)?; + let record_lit = ast::RecordExpr::cast(record_expr.syntax().parent()?.parent()?)?; let def_id = sema.resolve_variant(record_lit)?; let module; let def_file_id; @@ -263,8 +263,8 @@ fn check_struct_shorthand_initialization( file_id: FileId, node: &SyntaxNode, ) -> Option<()> { - let record_lit = ast::RecordLit::cast(node.clone())?; - let record_field_list = record_lit.record_field_list()?; + let record_lit = ast::RecordExpr::cast(node.clone())?; + let record_field_list = record_lit.record_expr_field_list()?; for record_field in record_field_list.fields() { if let (Some(name_ref), Some(expr)) = (record_field.name_ref(), record_field.expr()) { let field_name = name_ref.syntax().text().to_string(); diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index b1c4561c1..597a7d82f 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs @@ -41,7 +41,7 @@ fn try_extend_selection( MATCH_ARM_LIST, RECORD_FIELD_DEF_LIST, TUPLE_FIELD_DEF_LIST, - RECORD_FIELD_LIST, + RECORD_EXPR_FIELD_LIST, ENUM_VARIANT_LIST, USE_TREE_LIST, GENERIC_PARAM_LIST, diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs index bad079146..972505450 100644 --- a/crates/ra_ide/src/folding_ranges.rs +++ b/crates/ra_ide/src/folding_ranges.rs @@ -87,7 +87,7 @@ fn fold_kind(kind: SyntaxKind) -> Option { ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), RECORD_FIELD_DEF_LIST | RECORD_FIELD_PAT_LIST - | RECORD_FIELD_LIST + | RECORD_EXPR_FIELD_LIST | ITEM_LIST | EXTERN_ITEM_LIST | USE_TREE_LIST diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index f2e4f7ee5..714ba6bd9 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs @@ -96,7 +96,7 @@ fn get_chaining_hints( return None; } - if matches!(expr, ast::Expr::RecordLit(_)) { + if matches!(expr, ast::Expr::RecordExpr(_)) { return None; } diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 0e73a8932..6ea7f173b 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -236,7 +236,7 @@ pub fn classify_name_ref( } } - if let Some(record_field) = ast::RecordField::for_field_name(name_ref) { + if let Some(record_field) = ast::RecordExprField::for_field_name(name_ref) { if let Some((field, local)) = sema.resolve_record_field(&record_field) { let field = Definition::Field(field); let res = match local { diff --git a/crates/ra_ide_db/src/search.rs b/crates/ra_ide_db/src/search.rs index a7cae37b0..0b862b449 100644 --- a/crates/ra_ide_db/src/search.rs +++ b/crates/ra_ide_db/src/search.rs @@ -315,7 +315,7 @@ fn is_record_lit_name_ref(name_ref: &ast::NameRef) -> bool { name_ref .syntax() .ancestors() - .find_map(ast::RecordLit::cast) + .find_map(ast::RecordExpr::cast) .and_then(|l| l.path()) .and_then(|p| p.segment()) .map(|p| p.name_ref().as_ref() == Some(name_ref)) diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 7dfac2813..3610e7392 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs @@ -143,7 +143,7 @@ pub(crate) fn reparser( let res = match node { BLOCK_EXPR => expressions::block_expr, RECORD_FIELD_DEF_LIST => items::record_field_def_list, - RECORD_FIELD_LIST => items::record_field_list, + RECORD_EXPR_FIELD_LIST => items::record_field_list, ENUM_VARIANT_LIST => items::enum_variant_list, MATCH_ARM_LIST => items::match_arm_list, 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 6e72eea66..e1c25a838 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs @@ -587,7 +587,7 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { match p.current() { T!['{'] if !r.forbid_structs => { record_field_list(p); - (m.complete(p, RECORD_LIT), BlockLike::NotBlock) + (m.complete(p, RECORD_EXPR), BlockLike::NotBlock) } T![!] if !p.at(T![!=]) => { let block_like = items::macro_call_after_excl(p); @@ -627,7 +627,7 @@ pub(crate) fn record_field_list(p: &mut Parser) { p.expect(T![:]); } expr(p); - m.complete(p, RECORD_FIELD); + m.complete(p, RECORD_EXPR_FIELD); } T![.] if p.at(T![..]) => { m.abandon(p); @@ -648,5 +648,5 @@ pub(crate) fn record_field_list(p: &mut Parser) { } } p.expect(T!['}']); - m.complete(p, RECORD_FIELD_LIST); + m.complete(p, RECORD_EXPR_FIELD_LIST); } diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index b83690865..ac79786ff 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs @@ -188,9 +188,9 @@ pub enum SyntaxKind { MATCH_ARM_LIST, MATCH_ARM, MATCH_GUARD, - RECORD_LIT, - RECORD_FIELD_LIST, - RECORD_FIELD, + RECORD_EXPR, + RECORD_EXPR_FIELD_LIST, + RECORD_EXPR_FIELD, EFFECT_EXPR, BOX_EXPR, CALL_EXPR, diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs index c1b66748e..74e15c631 100644 --- a/crates/ra_ssr/src/matching.rs +++ b/crates/ra_ssr/src/matching.rs @@ -209,7 +209,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { // Some kinds of nodes have special handling. For everything else, we fall back to default // matching. match code.kind() { - SyntaxKind::RECORD_FIELD_LIST => { + SyntaxKind::RECORD_EXPR_FIELD_LIST => { self.attempt_match_record_field_list(phase, pattern, code) } SyntaxKind::TOKEN_TREE => self.attempt_match_token_tree(phase, pattern, code), @@ -399,7 +399,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { // Build a map keyed by field name. let mut fields_by_name = FxHashMap::default(); for child in code.children() { - if let Some(record) = ast::RecordField::cast(child.clone()) { + if let Some(record) = ast::RecordExprField::cast(child.clone()) { if let Some(name) = record.field_name() { fields_by_name.insert(name.text().clone(), child.clone()); } diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 0110300af..8d3e42f25 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs @@ -116,18 +116,18 @@ impl ast::AssocItemList { } } -impl ast::RecordFieldList { +impl ast::RecordExprFieldList { #[must_use] - pub fn append_field(&self, field: &ast::RecordField) -> ast::RecordFieldList { + pub fn append_field(&self, field: &ast::RecordExprField) -> ast::RecordExprFieldList { self.insert_field(InsertPosition::Last, field) } #[must_use] pub fn insert_field( &self, - position: InsertPosition<&'_ ast::RecordField>, - field: &ast::RecordField, - ) -> ast::RecordFieldList { + position: InsertPosition<&'_ ast::RecordExprField>, + field: &ast::RecordExprField, + ) -> ast::RecordExprFieldList { let is_multiline = self.syntax().text().contains_char('\n'); let ws; let space = if is_multiline { diff --git a/crates/ra_syntax/src/ast/expr_ext.rs b/crates/ra_syntax/src/ast/expr_ext.rs index 8692b9bb5..365f94287 100644 --- a/crates/ra_syntax/src/ast/expr_ext.rs +++ b/crates/ra_syntax/src/ast/expr_ext.rs @@ -412,8 +412,8 @@ fn test_literal_with_attr() { assert_eq!(lit.token().text(), r#""Hello""#); } -impl ast::RecordField { - pub fn parent_record_lit(&self) -> ast::RecordLit { - self.syntax().ancestors().find_map(ast::RecordLit::cast).unwrap() +impl ast::RecordExprField { + pub fn parent_record_lit(&self) -> ast::RecordExpr { + self.syntax().ancestors().find_map(ast::RecordExpr::cast).unwrap() } } diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index efe0cbe3a..9f9c06e50 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -909,30 +909,32 @@ impl MatchGuard { pub fn expr(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordLit { +pub struct RecordExpr { pub(crate) syntax: SyntaxNode, } -impl RecordLit { +impl RecordExpr { pub fn path(&self) -> Option { support::child(&self.syntax) } - pub fn record_field_list(&self) -> Option { support::child(&self.syntax) } + pub fn record_expr_field_list(&self) -> Option { + support::child(&self.syntax) + } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldList { +pub struct RecordExprFieldList { pub(crate) syntax: SyntaxNode, } -impl RecordFieldList { +impl RecordExprFieldList { pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } - pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } + pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } pub fn dotdot_token(&self) -> Option { support::token(&self.syntax, T![..]) } pub fn spread(&self) -> Option { support::child(&self.syntax) } pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordField { +pub struct RecordExprField { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for RecordField {} -impl RecordField { +impl ast::AttrsOwner for RecordExprField {} +impl RecordExprField { pub fn name_ref(&self) -> Option { support::child(&self.syntax) } pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } pub fn expr(&self) -> Option { support::child(&self.syntax) } @@ -1345,7 +1347,7 @@ pub enum Expr { BlockExpr(BlockExpr), ReturnExpr(ReturnExpr), MatchExpr(MatchExpr), - RecordLit(RecordLit), + RecordExpr(RecordExpr), CallExpr(CallExpr), IndexExpr(IndexExpr), MethodCallExpr(MethodCallExpr), @@ -2357,8 +2359,8 @@ impl AstNode for MatchGuard { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordLit { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_LIT } +impl AstNode for RecordExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2368,8 +2370,8 @@ impl AstNode for RecordLit { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordFieldList { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } +impl AstNode for RecordExprFieldList { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2379,8 +2381,8 @@ impl AstNode for RecordFieldList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordField { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } +impl AstNode for RecordExprField { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3119,8 +3121,8 @@ impl From for Expr { impl From for Expr { fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) } } -impl From for Expr { - fn from(node: RecordLit) -> Expr { Expr::RecordLit(node) } +impl From for Expr { + fn from(node: RecordExpr) -> Expr { Expr::RecordExpr(node) } } impl From for Expr { fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) } @@ -3172,7 +3174,7 @@ impl AstNode for Expr { match kind { TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL - | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR + | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_EXPR | CALL_EXPR | INDEX_EXPR | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => { true @@ -3197,7 +3199,7 @@ impl AstNode for Expr { BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), - RECORD_LIT => Expr::RecordLit(RecordLit { syntax }), + RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }), CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), @@ -3234,7 +3236,7 @@ impl AstNode for Expr { Expr::BlockExpr(it) => &it.syntax, Expr::ReturnExpr(it) => &it.syntax, Expr::MatchExpr(it) => &it.syntax, - Expr::RecordLit(it) => &it.syntax, + Expr::RecordExpr(it) => &it.syntax, Expr::CallExpr(it) => &it.syntax, Expr::IndexExpr(it) => &it.syntax, Expr::MethodCallExpr(it) => &it.syntax, @@ -3893,17 +3895,17 @@ impl std::fmt::Display for MatchGuard { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordLit { +impl std::fmt::Display for RecordExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordFieldList { +impl std::fmt::Display for RecordExprFieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordField { +impl std::fmt::Display for RecordExprField { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 4759f23a5..183ec4481 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -64,13 +64,13 @@ pub fn use_item(use_tree: ast::UseTree) -> ast::Use { ast_from_text(&format!("use {};", use_tree)) } -pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordField { +pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordExprField { return match expr { Some(expr) => from_text(&format!("{}: {}", name, expr)), None => from_text(&name.to_string()), }; - fn from_text(text: &str) -> ast::RecordField { + fn from_text(text: &str) -> ast::RecordExprField { ast_from_text(&format!("fn f() {{ S {{ {}, }} }}", text)) } } diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index a7a301d6b..8c7457e32 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs @@ -189,11 +189,11 @@ impl ast::StructDef { } } -impl ast::RecordField { - pub fn for_field_name(field_name: &ast::NameRef) -> Option { +impl ast::RecordExprField { + pub fn for_field_name(field_name: &ast::NameRef) -> Option { let candidate = - field_name.syntax().parent().and_then(ast::RecordField::cast).or_else(|| { - field_name.syntax().ancestors().nth(4).and_then(ast::RecordField::cast) + field_name.syntax().parent().and_then(ast::RecordExprField::cast).or_else(|| { + field_name.syntax().ancestors().nth(4).and_then(ast::RecordExprField::cast) })?; if candidate.field_name().as_ref() == Some(field_name) { Some(candidate) diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index 6a2749381..5b4e14676 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs @@ -91,7 +91,7 @@ pub(crate) fn validate(root: &SyntaxNode) -> Vec { ast::Literal(it) => validate_literal(it, &mut errors), ast::BlockExpr(it) => block::validate_block_expr(it, &mut errors), ast::FieldExpr(it) => validate_numeric_name(it.name_ref(), &mut errors), - ast::RecordField(it) => validate_numeric_name(it.name_ref(), &mut errors), + ast::RecordExprField(it) => validate_numeric_name(it.name_ref(), &mut errors), ast::Visibility(it) => validate_visibility(it, &mut errors), ast::RangeExpr(it) => validate_range_expr(it, &mut errors), ast::PathSegment(it) => validate_path_keywords(it, &mut errors), diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast index ce43ddf45..1ce5f188f 100644 --- a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast +++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast @@ -75,16 +75,16 @@ SOURCE_FILE@0..183 IDENT@106..110 "push" ARG_LIST@110..155 L_PAREN@110..111 "(" - RECORD_LIT@111..154 + RECORD_EXPR@111..154 PATH@111..120 PATH_SEGMENT@111..120 NAME_REF@111..120 IDENT@111..120 "ScopeData" WHITESPACE@120..121 " " - RECORD_FIELD_LIST@121..154 + RECORD_EXPR_FIELD_LIST@121..154 L_CURLY@121..122 "{" WHITESPACE@122..123 " " - RECORD_FIELD@123..135 + RECORD_EXPR_FIELD@123..135 NAME_REF@123..129 IDENT@123..129 "parent" COLON@129..130 ":" @@ -96,7 +96,7 @@ SOURCE_FILE@0..183 IDENT@131..135 "None" COMMA@135..136 "," WHITESPACE@136..137 " " - RECORD_FIELD@137..152 + RECORD_EXPR_FIELD@137..152 NAME_REF@137..144 IDENT@137..144 "entries" COLON@144..145 ":" diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast index 6753c3fe7..a81c442c0 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast @@ -11,16 +11,16 @@ SOURCE_FILE@0..45 BLOCK_EXPR@10..44 L_CURLY@10..11 "{" WHITESPACE@11..16 "\n " - RECORD_LIT@16..42 + RECORD_EXPR@16..42 PATH@16..17 PATH_SEGMENT@16..17 NAME_REF@16..17 IDENT@16..17 "S" WHITESPACE@17..18 " " - RECORD_FIELD_LIST@18..42 + RECORD_EXPR_FIELD_LIST@18..42 L_CURLY@18..19 "{" WHITESPACE@19..20 " " - RECORD_FIELD@20..40 + RECORD_EXPR_FIELD@20..40 NAME_REF@20..25 IDENT@20..25 "field" WHITESPACE@25..26 " " diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast index b0aa73b7d..a9ae1aa59 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast @@ -12,28 +12,28 @@ SOURCE_FILE@0..112 L_CURLY@9..10 "{" WHITESPACE@10..15 "\n " EXPR_STMT@15..20 - RECORD_LIT@15..19 + RECORD_EXPR@15..19 PATH@15..16 PATH_SEGMENT@15..16 NAME_REF@15..16 IDENT@15..16 "S" WHITESPACE@16..17 " " - RECORD_FIELD_LIST@17..19 + RECORD_EXPR_FIELD_LIST@17..19 L_CURLY@17..18 "{" R_CURLY@18..19 "}" SEMICOLON@19..20 ";" WHITESPACE@20..25 "\n " EXPR_STMT@25..41 - RECORD_LIT@25..40 + RECORD_EXPR@25..40 PATH@25..26 PATH_SEGMENT@25..26 NAME_REF@25..26 IDENT@25..26 "S" WHITESPACE@26..27 " " - RECORD_FIELD_LIST@27..40 + RECORD_EXPR_FIELD_LIST@27..40 L_CURLY@27..28 "{" WHITESPACE@28..29 " " - RECORD_FIELD@29..30 + RECORD_EXPR_FIELD@29..30 PATH_EXPR@29..30 PATH@29..30 PATH_SEGMENT@29..30 @@ -41,7 +41,7 @@ SOURCE_FILE@0..112 IDENT@29..30 "x" COMMA@30..31 "," WHITESPACE@31..32 " " - RECORD_FIELD@32..37 + RECORD_EXPR_FIELD@32..37 NAME_REF@32..33 IDENT@32..33 "y" COLON@33..34 ":" @@ -54,16 +54,16 @@ SOURCE_FILE@0..112 SEMICOLON@40..41 ";" WHITESPACE@41..46 "\n " EXPR_STMT@46..83 - RECORD_LIT@46..82 + RECORD_EXPR@46..82 PATH@46..47 PATH_SEGMENT@46..47 NAME_REF@46..47 IDENT@46..47 "S" WHITESPACE@47..48 " " - RECORD_FIELD_LIST@48..82 + RECORD_EXPR_FIELD_LIST@48..82 L_CURLY@48..49 "{" WHITESPACE@49..50 " " - RECORD_FIELD@50..51 + RECORD_EXPR_FIELD@50..51 PATH_EXPR@50..51 PATH@50..51 PATH_SEGMENT@50..51 @@ -71,7 +71,7 @@ SOURCE_FILE@0..112 IDENT@50..51 "x" COMMA@51..52 "," WHITESPACE@52..53 " " - RECORD_FIELD@53..58 + RECORD_EXPR_FIELD@53..58 NAME_REF@53..54 IDENT@53..54 "y" COLON@54..55 ":" @@ -100,16 +100,16 @@ SOURCE_FILE@0..112 SEMICOLON@82..83 ";" WHITESPACE@83..88 "\n " EXPR_STMT@88..109 - RECORD_LIT@88..108 + RECORD_EXPR@88..108 PATH@88..99 PATH_SEGMENT@88..99 NAME_REF@88..99 IDENT@88..99 "TupleStruct" WHITESPACE@99..100 " " - RECORD_FIELD_LIST@100..108 + RECORD_EXPR_FIELD_LIST@100..108 L_CURLY@100..101 "{" WHITESPACE@101..102 " " - RECORD_FIELD@102..106 + RECORD_EXPR_FIELD@102..106 NAME_REF@102..103 INT_NUMBER@102..103 "0" COLON@103..104 ":" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast index d2279877b..37ca478e6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast @@ -49,14 +49,14 @@ SOURCE_FILE@0..167 WHITESPACE@60..61 " " R_ANGLE@61..62 ">" WHITESPACE@62..63 " " - RECORD_LIT@63..77 + RECORD_EXPR@63..77 PATH@63..67 PATH_SEGMENT@63..67 NAME_REF@63..67 IDENT@63..67 "Test" - RECORD_FIELD_LIST@67..77 + RECORD_EXPR_FIELD_LIST@67..77 L_CURLY@67..68 "{" - RECORD_FIELD@68..76 + RECORD_EXPR_FIELD@68..76 NAME_REF@68..73 IDENT@68..73 "field" COLON@73..74 ":" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast index d6926425c..673d396ee 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast @@ -72,13 +72,13 @@ SOURCE_FILE@0..97 BLOCK_EXPR@82..90 L_CURLY@82..83 "{" WHITESPACE@83..84 " " - RECORD_LIT@84..88 + RECORD_EXPR@84..88 PATH@84..85 PATH_SEGMENT@84..85 NAME_REF@84..85 IDENT@84..85 "S" WHITESPACE@85..86 " " - RECORD_FIELD_LIST@86..88 + RECORD_EXPR_FIELD_LIST@86..88 L_CURLY@86..87 "{" R_CURLY@87..88 "}" WHITESPACE@88..89 " " diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast index 20979cef3..54ea2c7c6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast @@ -11,16 +11,16 @@ SOURCE_FILE@0..46 BLOCK_EXPR@10..45 L_CURLY@10..11 "{" WHITESPACE@11..16 "\n " - RECORD_LIT@16..43 + RECORD_EXPR@16..43 PATH@16..17 PATH_SEGMENT@16..17 NAME_REF@16..17 IDENT@16..17 "S" WHITESPACE@17..18 " " - RECORD_FIELD_LIST@18..43 + RECORD_EXPR_FIELD_LIST@18..43 L_CURLY@18..19 "{" WHITESPACE@19..20 " " - RECORD_FIELD@20..41 + RECORD_EXPR_FIELD@20..41 ATTR@20..32 POUND@20..21 "#" L_BRACK@21..22 "[" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast index a03139ab5..a7f87c020 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast @@ -22,14 +22,14 @@ SOURCE_FILE@0..52 WHITESPACE@23..24 " " EQ@24..25 "=" WHITESPACE@25..26 " " - RECORD_LIT@26..33 + RECORD_EXPR@26..33 PATH@26..27 PATH_SEGMENT@26..27 NAME_REF@26..27 IDENT@26..27 "F" - RECORD_FIELD_LIST@27..33 + RECORD_EXPR_FIELD_LIST@27..33 L_CURLY@27..28 "{" - RECORD_FIELD@28..32 + RECORD_EXPR_FIELD@28..32 NAME_REF@28..29 IDENT@28..29 "x" COLON@29..30 ":" diff --git a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast index 22eb22e3c..1c5545b6d 100644 --- a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast +++ b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast @@ -46,16 +46,16 @@ SOURCE_FILE@0..160 BIN_EXPR@107..135 INDEX_EXPR@107..131 FIELD_EXPR@107..128 - RECORD_LIT@107..124 + RECORD_EXPR@107..124 PATH@107..111 PATH_SEGMENT@107..111 NAME_REF@107..111 IDENT@107..111 "Repr" WHITESPACE@111..112 " " - RECORD_FIELD_LIST@112..124 + RECORD_EXPR_FIELD_LIST@112..124 L_CURLY@112..113 "{" WHITESPACE@113..114 " " - RECORD_FIELD@114..122 + RECORD_EXPR_FIELD@114..122 NAME_REF@114..117 IDENT@114..117 "raw" COLON@117..118 ":" @@ -83,14 +83,14 @@ SOURCE_FILE@0..160 WHITESPACE@136..141 "\n " EXPR_STMT@141..157 CALL_EXPR@141..156 - RECORD_LIT@141..154 + RECORD_EXPR@141..154 PATH@141..145 PATH_SEGMENT@141..145 NAME_REF@141..145 IDENT@141..145 "Repr" - RECORD_FIELD_LIST@145..154 + RECORD_EXPR_FIELD_LIST@145..154 L_CURLY@145..146 "{" - RECORD_FIELD@146..153 + RECORD_EXPR_FIELD@146..153 NAME_REF@146..149 IDENT@146..149 "raw" COLON@149..150 ":" -- cgit v1.2.3