Skip to content

Commit 6fea27c

Browse files
committed
Revert "Don't analyze platform specific blocks in syntactic phase"
This reverts commit ad1837d.
1 parent 4bf124a commit 6fea27c

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

‎rule-preprocessor/src/syntactic.rs‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ fn is_va_args_type(ty: &ast::Type) -> bool {
5454
false
5555
}
5656

57-
fn cfg_matches_host(attrs: impl Iterator<Item = ast::Attr>) -> bool {
58-
for attr in attrs {
57+
fn cfg_matches_host(fn_item: &ast::Fn) -> bool {
58+
for attr in fn_item.attrs() {
5959
let Some(meta) = attr.meta() else { continue };
6060
let Some(path) = meta.path() else { continue };
6161
if path.syntax().text() != "cfg" {
@@ -135,7 +135,7 @@ impl SyntacticAnalysis {
135135
let mut file_ir = FileIr::new();
136136

137137
for fn_item in source_file.syntax().descendants().filter_map(ast::Fn::cast) {
138-
if !cfg_matches_host(fn_item.attrs()) {
138+
if !cfg_matches_host(&fn_item) {
139139
continue;
140140
}
141141

@@ -202,16 +202,6 @@ impl<'a> FragmentCtx<'a> {
202202
match child {
203203
ra_ap_syntax::NodeOrToken::Token(token) => self.visit_token(&token),
204204
ra_ap_syntax::NodeOrToken::Node(node) => {
205-
if ast::Attr::can_cast(node.kind()) {
206-
self.text_buf.push_str(&node.text().to_string());
207-
return;
208-
}
209-
if let Some(has_attrs) = ast::AnyHasAttrs::cast(node.clone())
210-
&& !cfg_matches_host(has_attrs.attrs())
211-
{
212-
self.text_buf.push_str(&node.text().to_string());
213-
return;
214-
}
215205
if let Some(call) = ast::MethodCallExpr::cast(node.clone()) {
216206
self.emit_method_call(&call);
217207
return;

0 commit comments

Comments
 (0)