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

Method dedicated_property_branch

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

694 /// THE DEDICATED PROPERTY BRANCH (tree-sitter.ts:1113-1193, #1020).
695 /// Returns skipChildren.
696 fn dedicated_property_branch(&mut self, node: Node<'t>) -> bool {
697 stack_guard!();
698 let owner_row = self.top_row();
699 let info = self.swift_property_info(node);
700 let mut computed_prop: Option<(u32, String)> = None;
701
702 if let Some(name_node) = info.name_node {
703 let name = self.text(name_node).to_string();
704 if info.is_computed {
705 let row = self.create_node(
706 "property",
707 &name,
708 node,
709 Extra {
710 visibility: Some(self.visibility_of(node)),
711 is_static: Some(self.is_static(node)),
712 ..Extra::default()
713 },
714 );
715 if let Some(row) = row {
716 computed_prop = Some((row, name));
717 }
718 } else {
719 let is_static = self.is_static(node);
720 let kind: &'static str = if is_static {
721 if info.is_let { "constant" } else { "variable" }
722 } else {
723 "field"
724 };
725 self.create_node(
726 kind,
727 &name,
728 node,
729 Extra {
730 visibility: Some(self.visibility_of(node)),
731 is_static: Some(is_static),
732 ..Extra::default()
733 },
734 );
735 }
736 }
737
738 // All three ref passes attach to the ENCLOSING TYPE (ownerId).
739 self.extract_decorators_for(node, owner_row);
740 // extractVariableTypeAnnotation: the direct type_annotation child.
741 let ta = (0..node.named_child_count())
742 .filter_map(|i| node.named_child(i))
743 .find(|c| c.kind() == "type_annotation");
744 if let Some(ta) = ta {
745 self.extract_type_refs_from_subtree(ta, owner_row);
746 }
747 // walkAttrArgs: extractStaticMemberRef over the whole modifiers subtree
748 // (`@Siblings(through: Pivot.self)` metatype args).
749 let mods = (0..node.named_child_count())
750 .filter_map(|i| node.named_child(i))
751 .find(|c| c.kind() == "modifiers");
752 if let Some(mods) = mods {
753 self.walk_attr_args(mods);

Callers 1

visit_nodeMethod · 0.80

Calls 11

swift_property_infoMethod · 0.80
walk_attr_argsMethod · 0.80
pushMethod · 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