MCPcopy Create free account
hub / github.com/PerroEngine/Perro / parse_enum_fields

Function parse_enum_fields

perro_source/devtools/perro_cli/src/doctor.rs:1099–1153  ·  view source on GitHub ↗
(text: &str, enum_name: &str)

Source from the content-addressed store, hash-verified

1097 index.custom_type_fields.insert(type_name, fields);
1098 }
1099 }
1100 for state_name in parse_state_struct_names(text) {
1101 index.state_types.insert(state_name.clone());
1102 for field in parse_struct_fields(text, &state_name) {
1103 index
1104 .state_field_types
1105 .entry(field.name.clone())
1106 .or_default()
1107 .insert(field.ty.clone());
1108 index
1109 .state_field_owners
1110 .insert(field.name.clone(), state_name.clone());
1111 let defs = index
1112 .state_field_defs
1113 .entry(field.name.clone())
1114 .or_default();
1115 if !defs.contains(&field) {
1116 defs.push(field.clone());
1117 }
1118 let files = index
1119 .state_field_files
1120 .entry(field.name.clone())
1121 .or_default();
1122 if !files.iter().any(|known| known == file) {
1123 files.push(file.to_path_buf());
1124 }
1125 if field.is_pub {
1126 let pub_files = index
1127 .state_field_pub_files
1128 .entry(field.name.clone())
1129 .or_default();
1130 if !pub_files.iter().any(|known| known == file) {
1131 pub_files.push(file.to_path_buf());
1132 }
1133 }
1134 index
1135 .script_state_field_defs
1136 .entry(file.to_path_buf())
1137 .or_default()
1138 .insert(field.name.clone(), field.clone());
1139 index.state_fields.insert(field.name);
1140 }
1141 }
1142 for method in parse_script_methods(text) {
1143 let def = index.methods.entry(method.name).or_default();
1144 def.is_pub |= method.is_pub;
1145 def.dispatch |= method.has_ctx;
1146 if !def.files.iter().any(|known| known == file) {
1147 def.files.push(file.to_path_buf());
1148 }
1149 if method.is_pub && !def.pub_files.iter().any(|known| known == file) {
1150 def.pub_files.push(file.to_path_buf());
1151 }
1152 if method.is_pub
1153 && method.has_ctx
1154 && !def.dispatch_pub_files.iter().any(|known| known == file)
1155 {
1156 def.dispatch_pub_files.push(file.to_path_buf());

Callers 1

index_script_sourceFunction · 0.85

Calls 11

parse_enum_line_fieldsFunction · 0.85
brace_delta_for_doctorFunction · 0.85
parse_field_for_doctorFunction · 0.85
findMethod · 0.80
extendMethod · 0.80
positionMethod · 0.45
iterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected