MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / extract_init

Method extract_init

atomic-semantic/src/parsers/swift.rs:241–255  ·  view source on GitHub ↗

Extract an `init` declaration. Initializers have no explicit name — we use `"init"` as the entity name.

(&self, node: &Node, source: &str, file_path: &str)

Source from the content-addressed store, hash-verified

239 ///
240 /// Initializers have no explicit name — we use `"init"` as the entity name.
241 fn extract_init(&self, node: &Node, source: &str, file_path: &str) -> Option<Entity> {
242 let line = node.start_position().row as u32 + 1;
243 let end_line = node.end_position().row as u32 + 1;
244
245 let exported = self.is_exported(node, source);
246 let signature = self.build_init_signature(node, source);
247
248 let mut entity = Entity::new("init", EntityKind::Method, file_path, line, end_line);
249 if let Some(sig) = signature {
250 entity = entity.with_signature(sig);
251 }
252 entity.exported = exported;
253
254 Some(entity)
255 }
256
257 /// Extract a type declaration (class, struct, enum, protocol).
258 ///

Callers 1

walk_treeMethod · 0.80

Calls 3

is_exportedMethod · 0.80
build_init_signatureMethod · 0.80
with_signatureMethod · 0.80

Tested by

no test coverage detected