extractProperty (1986) — property_declaration only (dispatch-gated to class-like scopes). Type refs come from the `type` field; the caller walks the bodies (property_bodies) with the returned row on the stack.
(&mut self, node: Node<'t>)
| 803 | /// class-like scopes). Type refs come from the `type` field; the caller |
| 804 | /// walks the bodies (property_bodies) with the returned row on the stack. |
| 805 | fn extract_property(&mut self, node: Node<'t>) -> Option<(u32, String)> { |
| 806 | let docstring = preceding_docstring(node, self.src); |
| 807 | let visibility = Some(self.visibility_of(node)); |
| 808 | let is_static = Some(self.is_static(node)); // ?? false — always concrete |
| 809 | |
| 810 | let name_node = node |
| 811 | .child_by_field_name("name") |
| 812 | .or_else(|| node.child_by_field_name("property")) |
| 813 | .or_else(|| { |
| 814 | (0..node.named_child_count()) |
| 815 | .filter_map(|i| node.named_child(i)) |
| 816 | .find(|c| c.kind() == "identifier") |
| 817 | }); |
| 818 | let name_node = name_node?; |
| 819 | let name = self.text(name_node).to_string(); |
| 820 | if name.is_empty() { |
| 821 | return None; |
| 822 | } |
| 823 | |
| 824 | // Generic scan (isTsJsField=false): FIRST namedChild that isn't a |
| 825 | // modifier/name/accessor/initializer. A BARE-identifier declared type |
| 826 | // (`public Widget Parent {get;}`) is excluded by the `identifier` |
| 827 | // filter → the signature loses its type (QUIRK, preserve); the type |
| 828 | // ref below still fires via the `type` FIELD. |
| 829 | let type_node = (0..node.named_child_count()) |
| 830 | .filter_map(|i| node.named_child(i)) |
| 831 | .find(|c| { |
| 832 | !matches!( |
| 833 | c.kind(), |
| 834 | "modifier" | "modifiers" | "identifier" | "accessor_list" | "accessors" |
| 835 | | "equals_value_clause" |
| 836 | ) |
| 837 | }); |
| 838 | let type_text = type_node.map(|t| { |
| 839 | let raw = self.text(t); |
| 840 | // TS `.replace(/^:\s*/, '')` — inert for C# type text; mirrored. |
| 841 | match raw.strip_prefix(':') { |
| 842 | Some(rest) => rest.trim_start_matches(is_js_space).to_string(), |
| 843 | None => raw.to_string(), |
| 844 | } |
| 845 | }); |
| 846 | let signature = match &type_text { |
| 847 | Some(t) => format!("{t} {name}"), |
| 848 | None => name.clone(), |
| 849 | }; |
| 850 | |
| 851 | let row = self.create_node( |
| 852 | "property", |
| 853 | &name, |
| 854 | node, |
| 855 | Extra { docstring, signature: Some(signature), visibility, is_static, ..Extra::default() }, |
| 856 | )?; |
| 857 | // decorators: none for C#; then the csharp type-ref path. |
| 858 | self.extract_csharp_type_refs(node, row); |
| 859 | Some((row, name)) |
| 860 | } |
| 861 | |
| 862 | /// extractField (2046) — field_declaration; each declarator becomes a |
no test coverage detected