(module: &Module)
| 118 | } |
| 119 | |
| 120 | fn get_names(module: &Module) -> FxHashMap<Word, &str> { |
| 121 | let entry_names = module |
| 122 | .entry_points |
| 123 | .iter() |
| 124 | .filter(|i| i.class.opcode == Op::EntryPoint) |
| 125 | .map(|i| { |
| 126 | ( |
| 127 | i.operands[1].unwrap_id_ref(), |
| 128 | i.operands[2].unwrap_literal_string(), |
| 129 | ) |
| 130 | }); |
| 131 | let debug_names = module |
| 132 | .debug_names |
| 133 | .iter() |
| 134 | .filter(|i| i.class.opcode == Op::Name) |
| 135 | .map(|i| { |
| 136 | ( |
| 137 | i.operands[0].unwrap_id_ref(), |
| 138 | i.operands[1].unwrap_literal_string(), |
| 139 | ) |
| 140 | }); |
| 141 | // items later on take priority |
| 142 | entry_names.chain(debug_names).collect() |
| 143 | } |
| 144 | |
| 145 | fn get_name<'a>(names: &FxHashMap<Word, &'a str>, id: Word) -> Cow<'a, str> { |
| 146 | names.get(&id).map_or_else( |
no test coverage detected