diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-18 22:58:35 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-18 22:58:35 +0100 |
commit | 0d3bad85e60d011b35da0a8e5dd6611934f6816d (patch) | |
tree | 26403f2e9927f32698009cad0d8995ffa9cb058b /crates/syntax/src | |
parent | d9666ce5098442ab0cbac4d4363435074eb12923 (diff) | |
parent | 344cb5e76a31b8ef7ae80ce0ef39c54248ad8df7 (diff) |
Merge #9335
9335: feat: Don't insert imports outside of cfg attributed items r=Veykril a=Veykril
Closes #6939
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/syntax/src')
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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; | |||
8 | use rowan::{GreenNodeData, GreenTokenData}; | 8 | use rowan::{GreenNodeData, GreenTokenData}; |
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
11 | ast::{self, support, AstNode, AstToken, AttrsOwner, NameOwner, SyntaxNode}, | 11 | ast::{self, support, AstChildren, AstNode, AstToken, AttrsOwner, NameOwner, SyntaxNode}, |
12 | NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, TokenText, T, | 12 | NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, TokenText, T, |
13 | }; | 13 | }; |
14 | 14 | ||
@@ -45,6 +45,12 @@ fn text_of_first_token(node: &SyntaxNode) -> TokenText<'_> { | |||
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | impl ast::BlockExpr { | ||
49 | pub fn items(&self) -> AstChildren<ast::Item> { | ||
50 | support::children(self.syntax()) | ||
51 | } | ||
52 | } | ||
53 | |||
48 | #[derive(Debug, PartialEq, Eq, Clone)] | 54 | #[derive(Debug, PartialEq, Eq, Clone)] |
49 | pub enum Macro { | 55 | pub enum Macro { |
50 | MacroRules(ast::MacroRules), | 56 | MacroRules(ast::MacroRules), |