extractDartNamedPrimaryCtor (tree-sitter.ts) — a named Dart 3.13 primary constructor, `class Point.origin(final int x)`, is the type's named constructor: a method named `origin` returning the type (on top of the stack), which a call `Point.origin(…)` links (#3270).
(&mut self, node: Node<'t>)
| 1141 | /// named constructor: a method named `origin` returning the type (on top |
| 1142 | /// of the stack), which a call `Point.origin(…)` links (#3270). |
| 1143 | fn named_primary_ctor(&mut self, node: Node<'t>) { |
| 1144 | let Some(ctor) = node.child_by_field_name("primary_constructor") else { return }; |
| 1145 | let Some(name) = ctor.child_by_field_name("name").filter(|n| n.kind() == "identifier") else { |
| 1146 | return; |
| 1147 | }; |
| 1148 | let type_name = self.stack.last().map(|s| s.name.clone()); |
| 1149 | let signature = ctor |
| 1150 | .child_by_field_name("parameters") |
| 1151 | .map(|p| self.text(p).trim().to_string()) |
| 1152 | .filter(|s| !s.is_empty()); |
| 1153 | let name = self.text(name).to_string(); |
| 1154 | self.create_node( |
| 1155 | "method", |
| 1156 | &name, |
| 1157 | ctor, |
| 1158 | Extra { |
| 1159 | docstring: None, |
| 1160 | signature, |
| 1161 | visibility: 1, |
| 1162 | is_async: Some(false), |
| 1163 | is_static: Some(false), |
| 1164 | return_type: type_name, |
| 1165 | end_line_override: None, |
| 1166 | }, |
| 1167 | ); |
| 1168 | } |
| 1169 | |
| 1170 | /// extractEnumMembers (:1958) — one enum_member per constant, positioned |
| 1171 | /// at the enum_constant node; ctor arguments never walked. |
no test coverage detected