MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / dedicated_property_branch

Method dedicated_property_branch

codegraph-kernel/src/swift.rs:636–710  ·  view source on GitHub ↗

THE DEDICATED PROPERTY BRANCH (tree-sitter.ts:1113-1193, #1020). Returns skipChildren.

(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

634 /// THE DEDICATED PROPERTY BRANCH (tree-sitter.ts:1113-1193, #1020).
635 /// Returns skipChildren.
636 fn dedicated_property_branch(&mut self, node: Node<'t>) -> bool {
637 stack_guard!();
638 let owner_row = self.top_row();
639 let info = self.swift_property_info(node);
640 let mut computed_prop: Option<(u32, String)> = None;
641
642 if let Some(name_node) = info.name_node {
643 let name = self.text(name_node).to_string();
644 if info.is_computed {
645 let row = self.create_node(
646 "property",
647 &name,
648 node,
649 Extra {
650 visibility: Some(self.visibility_of(node)),
651 is_static: Some(self.is_static(node)),
652 ..Extra::default()
653 },
654 );
655 if let Some(row) = row {
656 computed_prop = Some((row, name));
657 }
658 } else {
659 let is_static = self.is_static(node);
660 let kind: &'static str = if is_static {
661 if info.is_let { "constant" } else { "variable" }
662 } else {
663 "field"
664 };
665 self.create_node(
666 kind,
667 &name,
668 node,
669 Extra {
670 visibility: Some(self.visibility_of(node)),
671 is_static: Some(is_static),
672 ..Extra::default()
673 },
674 );
675 }
676 }
677
678 // All three ref passes attach to the ENCLOSING TYPE (ownerId).
679 self.extract_decorators_for(node, owner_row);
680 // extractVariableTypeAnnotation: the direct type_annotation child.
681 let ta = (0..node.named_child_count())
682 .filter_map(|i| node.named_child(i))
683 .find(|c| c.kind() == "type_annotation");
684 if let Some(ta) = ta {
685 self.extract_type_refs_from_subtree(ta, owner_row);
686 }
687 // walkAttrArgs: extractStaticMemberRef over the whole modifiers subtree
688 // (`@Siblings(through: Pivot.self)` metatype args).
689 let mods = (0..node.named_child_count())
690 .filter_map(|i| node.named_child(i))
691 .find(|c| c.kind() == "modifiers");
692 if let Some(mods) = mods {
693 self.walk_attr_args(mods);

Callers 1

visit_nodeMethod · 0.80

Calls 10

swift_property_infoMethod · 0.80
walk_attr_argsMethod · 0.80
textMethod · 0.65
top_rowMethod · 0.45
create_nodeMethod · 0.45
visibility_ofMethod · 0.45
is_staticMethod · 0.45
visit_function_bodyMethod · 0.45

Tested by

no test coverage detected