mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
feat(query): Add right to VariableDeclaration (#718)
This commit is contained in:
parent
9c05866cc1
commit
97c5cd379e
2 changed files with 21 additions and 0 deletions
|
|
@ -1725,6 +1725,7 @@ pub(super) fn resolve_variable_declaration_edge<'a, 'b: 'a>(
|
|||
match edge_name {
|
||||
"span" => variable_declaration::span(contexts, resolve_info),
|
||||
"left" => variable_declaration::left(contexts, resolve_info),
|
||||
"right" => variable_declaration::right(contexts, resolve_info),
|
||||
"ancestor" => ancestors(contexts, adapter),
|
||||
"parent" => parents(contexts, adapter),
|
||||
_ => {
|
||||
|
|
@ -1775,4 +1776,23 @@ mod variable_declaration {
|
|||
)));
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn right<'a, 'b: 'a>(
|
||||
contexts: ContextIterator<'a, Vertex<'b>>,
|
||||
_resolve_info: &ResolveEdgeInfo,
|
||||
) -> ContextOutcomeIterator<'a, Vertex<'b>, VertexIterator<'a, Vertex<'b>>> {
|
||||
resolve_neighbors_with(contexts, |v| {
|
||||
Box::new(
|
||||
v.as_variable_declaration()
|
||||
.unwrap_or_else(|| {
|
||||
panic!("expected to have a typeannotation vertex, instead have: {v:#?}")
|
||||
})
|
||||
.variable_declaration
|
||||
.init
|
||||
.as_ref()
|
||||
.into_iter()
|
||||
.map(Vertex::from),
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,6 +366,7 @@ this will fire once per assignment.
|
|||
"""
|
||||
type VariableDeclarationAST implements VariableDeclaration & ASTNode & HasSpan {
|
||||
left: AssignmentType!
|
||||
right: Expression
|
||||
# ASTNode
|
||||
parent: ASTNode
|
||||
ancestor: [ASTNode!]!
|
||||
|
|
|
|||
Loading…
Reference in a new issue