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

Method dedicated_property_branch

codegraph-kernel/src/swift.rs:634–707  ·  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

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

Callers 1

visit_nodeMethod · 0.80

Calls 10

swift_property_infoMethod · 0.80
walk_attr_argsMethod · 0.80
top_rowMethod · 0.45
textMethod · 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