From 26ed92568596ce45ad96c3e2ea5d54099702537f Mon Sep 17 00:00:00 2001 From: Sergey Parilin Date: Thu, 11 Apr 2019 00:00:56 +0300 Subject: fill struct fields diagnostic --- crates/ra_syntax/src/ast/generated.rs | 8 ++++---- crates/ra_syntax/src/grammar.ron | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 89d3a35c5..e73fe22e9 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -2371,6 +2371,10 @@ impl NamedFieldList { pub fn fields(&self) -> impl Iterator { super::children(self) } + + pub fn spread(&self) -> Option<&Expr> { + super::child_opt(self) + } } // NeverType @@ -3564,10 +3568,6 @@ impl StructLit { pub fn named_field_list(&self) -> Option<&NamedFieldList> { super::child_opt(self) } - - pub fn spread(&self) -> Option<&Expr> { - super::child_opt(self) - } } // StructPat diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index c7abdd6dc..b8665bbc8 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -451,8 +451,11 @@ Grammar( traits: [ "AttrsOwner" ] ), "MatchGuard": (options: ["Expr"]), - "StructLit": (options: ["Path", "NamedFieldList", ["spread", "Expr"]]), - "NamedFieldList": (collections: [ ["fields", "NamedField"] ]), + "StructLit": (options: ["Path", "NamedFieldList"]), + "NamedFieldList": ( + collections: [ ["fields", "NamedField"] ], + options: [["spread", "Expr"]] + ), "NamedField": (options: ["NameRef", "Expr"]), "CallExpr": ( traits: ["ArgListOwner"], -- cgit v1.2.3