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