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