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