diff options
Diffstat (limited to 'xtask/src/codegen')
-rw-r--r-- | xtask/src/codegen/gen_syntax.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index cafad8070..af9d63b06 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs | |||
@@ -91,18 +91,16 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> Result<String> { | |||
91 | support::children(&self.syntax) | 91 | support::children(&self.syntax) |
92 | } | 92 | } |
93 | } | 93 | } |
94 | } else { | 94 | } else if let Some(token_kind) = field.token_kind() { |
95 | if let Some(token_kind) = field.token_kind() { | 95 | quote! { |
96 | quote! { | 96 | pub fn #method_name(&self) -> Option<#ty> { |
97 | pub fn #method_name(&self) -> Option<#ty> { | 97 | support::token(&self.syntax, #token_kind) |
98 | support::token(&self.syntax, #token_kind) | ||
99 | } | ||
100 | } | 98 | } |
101 | } else { | 99 | } |
102 | quote! { | 100 | } else { |
103 | pub fn #method_name(&self) -> Option<#ty> { | 101 | quote! { |
104 | support::child(&self.syntax) | 102 | pub fn #method_name(&self) -> Option<#ty> { |
105 | } | 103 | support::child(&self.syntax) |
106 | } | 104 | } |
107 | } | 105 | } |
108 | } | 106 | } |