MCPcopy Index your code
hub / github.com/cretz/stackparam / method_ref_const

Function method_ref_const

src/manip.rs:331–350  ·  view source on GitHub ↗
(class_file: &mut Classfile, class_name: &str, method_name: &str, desc: &str)

Source from the content-addressed store, hash-verified

329}
330
331fn 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}

Callers 1

update_fill_methodFunction · 0.85

Calls 3

class_constFunction · 0.85
name_and_type_constFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected