mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Rust: use macro to inject extraction functions for detached properties
This commit is contained in:
@@ -419,8 +419,9 @@ fn write_extractor(grammar: &AstSrc) -> std::io::Result<String> {
|
||||
"//! Generated by `ast-generator`, do not edit by hand.\n
|
||||
#![cfg_attr(any(), rustfmt::skip)]
|
||||
|
||||
use crate::generated;
|
||||
use super::base::{{TextValue, Translator}};
|
||||
use crate::emit_detached;
|
||||
use crate::generated;
|
||||
use crate::trap::{{Label, TrapId}};
|
||||
use ra_ap_syntax::ast::{{
|
||||
HasArgList, HasAttrs, HasGenericArgs, HasGenericParams, HasLoopBody, HasModuleItem, HasName,
|
||||
@@ -520,6 +521,11 @@ impl Translator<'_> {{
|
||||
}
|
||||
writeln!(buf, " }});")?;
|
||||
writeln!(buf, " self.emit_location(label, &node);")?;
|
||||
writeln!(
|
||||
buf,
|
||||
" emit_detached!({}, self, node, label);",
|
||||
class_name
|
||||
)?;
|
||||
writeln!(
|
||||
buf,
|
||||
" self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());"
|
||||
|
||||
Reference in New Issue
Block a user