Skip to content

Commit d245800

Browse files
committed
Rust: Skip unreachable rust-analyzer nodes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a04d83d9-ceea-4109-8ce1-f420585125d4
1 parent 1cf8337 commit d245800

2 files changed

Lines changed: 8 additions & 20 deletions

File tree

‎rust/ast-generator/src/main.rs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ fn should_node_be_skipped(name: &str) -> bool {
8080

8181
fn should_node_be_skipped_in_extractor(name: &str) -> bool {
8282
name == "Adt" // no fields have `Adt` type, so we don't need extraction for it
83+
|| name == "AnyAttr" // no fields have `AnyAttr` type
84+
|| name == "DocComment" // doc comments are not extracted yet
8385
}
8486

8587
fn should_field_be_skipped(node_name: &str, field_name: &str) -> bool {
@@ -473,7 +475,12 @@ fn write_extractor(grammar: &AstSrc, mustache_ctx: &mustache::Context) -> mustac
473475
.filter(|e| !should_node_be_skipped_in_extractor(&e.name))
474476
.map(enum_to_extractor_info)
475477
.collect(),
476-
nodes: grammar.nodes.iter().map(node_to_extractor_info).collect(),
478+
nodes: grammar
479+
.nodes
480+
.iter()
481+
.filter(|n| !should_node_be_skipped_in_extractor(&n.name))
482+
.map(node_to_extractor_info)
483+
.collect(),
477484
};
478485
let template = mustache_ctx.compile_path("extractor")?;
479486
let res = template.render_to_string(&extractor_info)?;

‎rust/extractor/src/translate/generated.rs‎

Lines changed: 0 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)