MCPcopy Create free account
hub / github.com/cretz/stackparam / str_const

Function str_const

src/manip.rs:253–268  ·  view source on GitHub ↗
(class_file: &mut Classfile, str: &str)

Source from the content-addressed store, hash-verified

251
252#[allow(dead_code)]
253fn str_const(class_file: &mut Classfile, str: &str) -> usize {
254 let utf8_idx = utf8_const(class_file, str);
255 for i in 0..class_file.constant_pool.constants.len() {
256 match class_file.constant_pool.constants[i] {
257 Constant::String(ref idx) => {
258 if idx.idx == utf8_idx {
259 return i;
260 }
261 },
262 _ => ()
263 }
264 }
265 let ret = class_file.constant_pool.constants.len();
266 class_file.constant_pool.constants.push(Constant::String(ConstantPoolIndex { idx: utf8_idx }));
267 return ret;
268}
269
270fn class_const(class_file: &mut Classfile, class_name: &str) -> usize {
271 let utf8_idx = utf8_const(class_file, class_name);

Callers

nothing calls this directly

Calls 2

utf8_constFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected