use tree_sitter::Node;
use super::{argument_place, GrammarHandler};
pub(super) fn assignment_place(node: Node<'_>, src: &[u8], handler: &GrammarHandler) -> Option<String> {
handler
.assignment_place_extractor
.and_then(|extract| extract(node, src))
.or_else(|| argument_place(&node, src, handler))
}
pub(super) fn type_only_declaration_without_initializer(node: &Node<'_>, handler: &GrammarHandler) -> bool {
handler.type_only_declaration_kinds.contains(&node.kind())
&& node.child_by_field_name("value").is_none()
&& node.child_by_field_name("right").is_none()
}
pub(super) fn qualified_assign_target(
node: Option<Node<'_>>,
src: &[u8],
handler: &GrammarHandler,
) -> Option<String> {
let target_node = node?;
let target_kind = target_node.kind();
if let Some(place) = handler
.assignment_place_extractor
.and_then(|extract| extract(target_node, src))
{
return Some(place);
}
if !handler.member_expression_kinds.contains(&target_kind)
&& !handler.subscript_expression_kinds.contains(&target_kind)
{
return None;
}
argument_place(&target_node, src, handler)
}