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

Method has_modifier

src/extraction/java_extractor.rs:960–975  ·  view source on GitHub ↗

Check if a node has a specific modifier keyword.

(node: TsNode<'_>, state: &ExtractionState, modifier: &str)

Source from the content-addressed store, hash-verified

958
959 /// Check if a node has a specific modifier keyword.
960 fn has_modifier(node: TsNode<'_>, state: &ExtractionState, modifier: &str) -> bool {
961 let mut cursor = node.walk();
962 if cursor.goto_first_child() {
963 loop {
964 let child = cursor.node();
965 if child.kind() == "modifiers" {
966 let text = state.node_text(child);
967 return text.split_whitespace().any(|w| w == modifier);
968 }
969 if !cursor.goto_next_sibling() {
970 break;
971 }
972 }
973 }
974 false
975 }
976
977 /// Check if a node has a direct child of a given kind.
978 fn has_child_of_kind(node: TsNode<'_>, kind: &str) -> bool {

Callers

nothing calls this directly

Calls 2

kindMethod · 0.80
node_textMethod · 0.45

Tested by

no test coverage detected