MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / extract_import_module

Method extract_import_module

src/extraction/zig_extractor.rs:309–320  ·  view source on GitHub ↗

Extract the module name from an @import `builtin_function` node. Looks for the string child inside the arguments: `@import("std")` -> `"std"`.

(state: &ExtractionState, builtin_node: TsNode<'_>)

Source from the content-addressed store, hash-verified

307 ///
308 /// Looks for the string child inside the arguments: `@import("std")` -> `"std"`.
309 fn extract_import_module(state: &ExtractionState, builtin_node: TsNode<'_>) -> Option<String> {
310 // arguments -> string -> string_content
311 let args = find_direct_child_by_kind(builtin_node, "arguments")?;
312 let string_node = find_direct_child_by_kind(args, "string")?;
313 let content = find_direct_child_by_kind(string_node, "string_content")?;
314 let text = state.node_text(content);
315 if text.is_empty() {
316 None
317 } else {
318 Some(text)
319 }
320 }
321
322 // ----------------------------------
323 // Struct

Callers

nothing calls this directly

Calls 3

node_textMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected