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

Method dedicated_property_branch

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

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