(class_file: &mut Classfile, class_name: &str, method_name: &str, desc: &str)
| 329 | } |
| 330 | |
| 331 | fn method_ref_const(class_file: &mut Classfile, class_name: &str, method_name: &str, desc: &str) -> usize { |
| 332 | let class_idx = class_const(class_file, class_name); |
| 333 | let name_and_type_idx = name_and_type_const(class_file, method_name, desc); |
| 334 | for i in 0..class_file.constant_pool.constants.len() { |
| 335 | match class_file.constant_pool.constants[i] { |
| 336 | Constant::MethodRef { ref class_index, ref name_and_type_index } => { |
| 337 | if class_index.idx == class_idx && name_and_type_index.idx == name_and_type_idx { |
| 338 | return i; |
| 339 | } |
| 340 | }, |
| 341 | _ => () |
| 342 | } |
| 343 | } |
| 344 | let ret = class_file.constant_pool.constants.len(); |
| 345 | class_file.constant_pool.constants.push(Constant::MethodRef { |
| 346 | class_index: ConstantPoolIndex { idx: class_idx }, |
| 347 | name_and_type_index: ConstantPoolIndex { idx: name_and_type_idx }, |
| 348 | }); |
| 349 | return ret; |
| 350 | } |
no test coverage detected