mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
visitor
This commit is contained in:
parent
d5119133fc
commit
7afd84febc
11 changed files with 211 additions and 86 deletions
|
@ -1,9 +1,11 @@
|
|||
use std::sync::Arc;
|
||||
use {
|
||||
ast,
|
||||
SyntaxNode, SyntaxRoot, TreeRoot, AstNode,
|
||||
SyntaxKind::*,
|
||||
};
|
||||
{% for node, methods in ast %}
|
||||
// {{ node }}
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct {{ node }}<R: TreeRoot = Arc<SyntaxRoot>> {
|
||||
syntax: SyntaxNode<R>,
|
||||
|
@ -19,6 +21,12 @@ impl<R: TreeRoot> AstNode<R> for {{ node }}<R> {
|
|||
fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
|
||||
}
|
||||
|
||||
{% if methods.traits -%}
|
||||
{%- for t in methods.traits -%}
|
||||
impl<R: TreeRoot> ast::{{ t }}<R> for {{ node }}<R> {}
|
||||
{% endfor -%}
|
||||
{%- endif -%}
|
||||
|
||||
impl<R: TreeRoot> {{ node }}<R> {
|
||||
{%- if methods.collections -%}
|
||||
{%- for m in methods.collections -%}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue