mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(query): impl Typename for VariableDeclaration (#638)
This commit is contained in:
parent
318d55806f
commit
997eb26d3e
2 changed files with 12 additions and 2 deletions
|
|
@ -103,6 +103,7 @@ query {
|
|||
span_asmt_type_end: u64,
|
||||
entire_span_start: u64,
|
||||
entire_span_end: u64,
|
||||
__typename: String,
|
||||
}
|
||||
|
||||
let mut results: Vec<Output> = execute_query(
|
||||
|
|
@ -120,6 +121,8 @@ query {
|
|||
}
|
||||
}
|
||||
|
||||
__typename @output
|
||||
|
||||
entire_span_: entire_span {
|
||||
start @output
|
||||
end @output
|
||||
|
|
@ -142,7 +145,8 @@ query {
|
|||
span_asmt_type_start: 6,
|
||||
span_asmt_type_end: 11,
|
||||
entire_span_start: 6,
|
||||
entire_span_end: 15
|
||||
entire_span_end: 15,
|
||||
__typename: "VariableDeclarationAST".to_owned()
|
||||
}],
|
||||
results
|
||||
);
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ impl Typename for Vertex<'_> {
|
|||
Vertex::TypeAnnotation(tn) => tn.typename(),
|
||||
Vertex::Type(_) => "Type",
|
||||
Vertex::Url(_) => "URL",
|
||||
Vertex::VariableDeclaration(_) => "VariableDeclaration",
|
||||
Vertex::VariableDeclaration(vd) => vd.typename(),
|
||||
Vertex::ReturnStatementAST(_) => "ReturnStatementAST",
|
||||
}
|
||||
}
|
||||
|
|
@ -346,3 +346,9 @@ pub struct VariableDeclarationVertex<'a> {
|
|||
ast_node: Option<AstNode<'a>>,
|
||||
pub variable_declaration: &'a VariableDeclarator<'a>,
|
||||
}
|
||||
|
||||
impl<'a> Typename for VariableDeclarationVertex<'a> {
|
||||
fn typename(&self) -> &'static str {
|
||||
if self.ast_node.is_some() { "VariableDeclarationAST" } else { "VariableDeclaration" }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue