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

Function macro_capture_field_values

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

captureFieldValues: each `field: value` entry of a struct literal.

(tokens: &[Node<'t>], src: &'t str, out: &mut Vec<MacroRef<'t>>)

Source from the content-addressed store, hash-verified

2031
2032/// captureFieldValues: each `field: value` entry of a struct literal.
2033fn macro_capture_field_values<'t>(tokens: &[Node<'t>], src: &'t str, out: &mut Vec<MacroRef<'t>>) {
2034 let mut from = 0usize;
2035 for i in 0..=tokens.len() {
2036 if i < tokens.len() && tokens[i].kind() != "," {
2037 continue;
2038 }
2039 if i >= from + 3 && tokens[from + 1].kind() == ":" {
2040 let field = tokens[from];
2041 if macro_is_name(Some(&field), src) || field.kind() == "integer_literal" {
2042 macro_capture_value(tokens, from + 2, i, src, out);
2043 }
2044 }
2045 from = i + 1;
2046 }
2047}
2048
2049/// captureValue: `tokens[from..to)` as a function value — an identifier
2050/// alone, or a path alone whose last segment is written like a function's

Callers 1

macro_parse_chainFunction · 0.85

Calls 3

macro_is_nameFunction · 0.85
macro_capture_valueFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected