From 7f3bf7cc738d02fde80d4fde9f32cbbe72896b87 Mon Sep 17 00:00:00 2001 From: Lenard Pratt Date: Sat, 30 Mar 2019 10:50:00 +0000 Subject: Added defWithBody --- crates/ra_syntax/src/ast/generated.rs | 1 + crates/ra_syntax/src/grammar.ron | 2 ++ 2 files changed, 3 insertions(+) (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 47a37e4d1..31b4e73fb 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -657,6 +657,7 @@ impl ToOwned for ContinueExpr { } + impl ContinueExpr {} // DynTraitType diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index ad6d74162..19e50c9b8 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -313,6 +313,7 @@ Grammar( "DocCommentsOwner", "TypeAscriptionOwner", ], + options: ["body","Block"], ), "StaticDef": ( traits: [ @@ -323,6 +324,7 @@ Grammar( "DocCommentsOwner", "TypeAscriptionOwner", ], + options: ["body","Block"], ), "TypeAliasDef": ( traits: [ -- cgit v1.2.3 From 88e22e9d70ac3a35989ad1d45386f86697877c4c Mon Sep 17 00:00:00 2001 From: Lenard Pratt Date: Sat, 30 Mar 2019 11:17:31 +0000 Subject: Added const bodies and static body to the ast and added inference the inference test reduce code duplication --- crates/ra_syntax/src/ast/generated.rs | 13 ++++++++++--- crates/ra_syntax/src/grammar.ron | 4 ++-- 2 files changed, 12 insertions(+), 5 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 31b4e73fb..84f39cda1 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -629,7 +629,11 @@ impl ast::TypeParamsOwner for ConstDef {} impl ast::AttrsOwner for ConstDef {} impl ast::DocCommentsOwner for ConstDef {} impl ast::TypeAscriptionOwner for ConstDef {} -impl ConstDef {} +impl ConstDef { + pub fn body(&self) -> Option<&Expr> { + super::child_opt(self) + } +} // ContinueExpr #[derive(Debug, PartialEq, Eq, Hash)] @@ -657,7 +661,6 @@ impl ToOwned for ContinueExpr { } - impl ContinueExpr {} // DynTraitType @@ -3808,7 +3811,11 @@ impl ast::TypeParamsOwner for StaticDef {} impl ast::AttrsOwner for StaticDef {} impl ast::DocCommentsOwner for StaticDef {} impl ast::TypeAscriptionOwner for StaticDef {} -impl StaticDef {} +impl StaticDef { + pub fn body(&self) -> Option<&Expr> { + super::child_opt(self) + } +} // Stmt #[derive(Debug, PartialEq, Eq, Hash)] diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 19e50c9b8..a21c3917d 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -313,7 +313,7 @@ Grammar( "DocCommentsOwner", "TypeAscriptionOwner", ], - options: ["body","Block"], + options: [ ["body","Expr"]], ), "StaticDef": ( traits: [ @@ -324,7 +324,7 @@ Grammar( "DocCommentsOwner", "TypeAscriptionOwner", ], - options: ["body","Block"], + options: [ ["body","Expr"]], ), "TypeAliasDef": ( traits: [ -- cgit v1.2.3