MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / extract_rust_macro_refs

Method extract_rust_macro_refs

codegraph-kernel/src/rustlang.rs:1062–1086  ·  view source on GitHub ↗

extractRustMacroCalls (#3251): the calls and variant paths in the arguments of an expression macro (`format!`, `assert_eq!`, `vec!`, `write!`, `matches!`, `json!`), read from its token tree as the call extractor names them (rust_macro_arg_refs), and the functions those arguments pass as values (#3484), which join the file's other candidates, behind them, for the gate at its end. A macro the file d

(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

1060 /// declares to take Rust code is read like the listed ones. Mirrors
1061 /// rust-macro-calls.ts byte-for-byte — change both.
1062 fn extract_rust_macro_refs(&mut self, node: Node<'t>) {
1063 if self.stack.is_empty() {
1064 return;
1065 }
1066 let refs = rust_macro_arg_refs(node, self.src, &self.declared_macros);
1067 if refs.is_empty() {
1068 return;
1069 }
1070 let from = self.top_row();
1071 for r in refs {
1072 if r.kind == "function_ref" {
1073 let p = r.at.start_position();
1074 self.macro_fn_ref_cands.push(Cand {
1075 from,
1076 name: r.name,
1077 line: p.row as u32 + 1,
1078 column_byte: r.at.start_byte(),
1079 row: p.row,
1080 });
1081 continue;
1082 }
1083 let kind = edge_kind_index(r.kind).unwrap();
1084 self.push_ref_at(from, &r.name, kind, r.at);
1085 }
1086 }
1087
1088 /// extractRustRouteMacro — body-walker-only; bare `routes`/`catchers`
1089 /// identifiers only (`rocket::routes![…]` is skipped); identifier runs in

Callers 1

Calls 6

rust_macro_arg_refsFunction · 0.85
edge_kind_indexFunction · 0.85
pushMethod · 0.80
unwrapMethod · 0.60
top_rowMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected