From 344cb5e76a31b8ef7ae80ce0ef39c54248ad8df7 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 18 Jun 2021 23:53:41 +0200 Subject: Don't insert imports outside of cfg attributed items --- crates/syntax/src/ast/node_ext.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/syntax/src') diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index 3c92a486f..e33e5bb03 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -8,7 +8,7 @@ use parser::SyntaxKind; use rowan::{GreenNodeData, GreenTokenData}; use crate::{ - ast::{self, support, AstNode, AstToken, AttrsOwner, NameOwner, SyntaxNode}, + ast::{self, support, AstChildren, AstNode, AstToken, AttrsOwner, NameOwner, SyntaxNode}, NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, TokenText, T, }; @@ -45,6 +45,12 @@ fn text_of_first_token(node: &SyntaxNode) -> TokenText<'_> { } } +impl ast::BlockExpr { + pub fn items(&self) -> AstChildren { + support::children(self.syntax()) + } +} + #[derive(Debug, PartialEq, Eq, Clone)] pub enum Macro { MacroRules(ast::MacroRules), -- cgit v1.2.3