pub fn parse_stack_map_table(decoder: &mut Decoder) -> Result<Attribute> {
    let count = decoder.read_u16()?;
    let mut table = Vec::with_capacity(count as usize);

    for _ in 0..count {
        let frame_type = decoder.read_u8()?;
        let frame = match frame_type {
            0...63 => StackMapFrame::Same {
                offset_delta: u16::from(frame_type),
            },
            64...127 => StackMapFrame::Same1 {
                offset_delta: u16::from(frame_type) - 64,
                stack: parse_verification_type(decoder)?,
            },
            247 => StackMapFrame::Same1 {
                offset_delta: decoder.read_u16()?,
                stack: parse_verification_type(decoder)?,
            },
            248...250 => StackMapFrame::Chop {
                offset_delta: decoder.read_u16()?,
                count: 251 - frame_type,
            },
            251 => StackMapFrame::Same {
                offset_delta: decoder.read_u16()?,
            },
            252...254 => {
                let offset_delta = decoder.read_u16()?;
                let dif = frame_type as usize - 251;
                let mut locals = Vec::with_capacity(dif);
                for _ in 0..dif {
                    locals.push(parse_verification_type(decoder)?);
                }

                StackMapFrame::Append {
                    offset_delta,
                    locals,
                }
            }
            255 => {
                let offset_delta = decoder.read_u16()?;
                let local_count = decoder.read_u16()? as usize;
                let mut locals = Vec::with_capacity(local_count);
                for _ in 0..local_count {
                    locals.push(parse_verification_type(decoder)?);
                }

                let stack_size = decoder.read_u16()? as usize;
                let mut stack = Vec::with_capacity(stack_size);
                for _ in 0..stack_size {
                    stack.push(parse_verification_type(decoder)?);
                }

                StackMapFrame::Full {
                    offset_delta,
                    locals,
                    stack,
                }
            }

            _ => return Err(Error::ReservedStackMapFrame(frame_type)),
        };
        table.push(frame);
    }

    Ok(Attribute::StackMapTable(table))
}
/// Parses the `StackMapTable` attribute.
Parses the `StackMapTable` attribute.
Parses the ` StackMapTable ` attribute .
pub fn parse_stack_map_table(decoder: &mut Decoder) -> Result<Attribute> {
    let count = decoder.read_u16()?;
    let mut table = Vec::with_capacity(count as usize);
    for _ in 0..count {
        let frame_type = decoder.read_u8()?;
        let frame = match frame_type {
            0...63 => StackMapFrame::Same {
                offset_delta: u16::from(frame_type),
            },
            64...127 => StackMapFrame::Same1 {
                offset_delta: u16::from(frame_type) - 64,
                stack: parse_verification_type(decoder)?,
            },
            247 => StackMapFrame::Same1 {
                offset_delta: decoder.read_u16()?,
                stack: parse_verification_type(decoder)?,
            },
            248...250 => StackMapFrame::Chop {
                offset_delta: decoder.read_u16()?,
                count: 251 - frame_type,
            },
            251 => StackMapFrame::Same {
                offset_delta: decoder.read_u16()?,
            },
            252...254 => {
                let offset_delta = decoder.read_u16()?;
                let dif = frame_type as usize - 251;
                let mut locals = Vec::with_capacity(dif);
                for _ in 0..dif {
                    locals.push(parse_verification_type(decoder)?);
                }
                StackMapFrame::Append {
                    offset_delta,
                    locals,
                }
            }
            255 => {
                let offset_delta = decoder.read_u16()?;
                let local_count = decoder.read_u16()? as usize;
                let mut locals = Vec::with_capacity(local_count);
                for _ in 0..local_count {
                    locals.push(parse_verification_type(decoder)?);
                }
                let stack_size = decoder.read_u16()? as usize;
                let mut stack = Vec::with_capacity(stack_size);
                for _ in 0..stack_size {
                    stack.push(parse_verification_type(decoder)?);
                }
                StackMapFrame::Full {
                    offset_delta,
                    locals,
                    stack,
                }
            }
            _ => return Err(Error::ReservedStackMapFrame(frame_type)),
        };
        table.push(frame);
    }
    Ok(Attribute::StackMapTable(table))
}
pub fn parse_stack_map_table ( decoder : & mut Decoder ) -> Result < Attribute > { let count = decoder . read_u16 ( ) ? ; let mut table = Vec :: with_capacity ( count as usize ) ; for _ in 0 .. count { let frame_type = decoder . read_u8 ( ) ? ; let frame = match frame_type { 0 ... 63 => StackMapFrame :: Same { offset_delta : u16 :: from ( frame_type ) , } , 64 ... 127 => StackMapFrame :: Same1 { offset_delta : u16 :: from ( frame_type ) - 64 , stack : parse_verification_type ( decoder ) ? , } , 247 => StackMapFrame :: Same1 { offset_delta : decoder . read_u16 ( ) ? , stack : parse_verification_type ( decoder ) ? , } , 248 ... 250 => StackMapFrame :: Chop { offset_delta : decoder . read_u16 ( ) ? , count : 251 - frame_type , } , 251 => StackMapFrame :: Same { offset_delta : decoder . read_u16 ( ) ? , } , 252 ... 254 => { let offset_delta = decoder . read_u16 ( ) ? ; let dif = frame_type as usize - 251 ; let mut locals = Vec :: with_capacity ( dif ) ; for _ in 0 .. dif { locals . push ( parse_verification_type ( decoder ) ? ) ; } StackMapFrame :: Append { offset_delta , locals , } } 255 => { let offset_delta = decoder . read_u16 ( ) ? ; let local_count = decoder . read_u16 ( ) ? as usize ; let mut locals = Vec :: with_capacity ( local_count ) ; for _ in 0 .. local_count { locals . push ( parse_verification_type ( decoder ) ? ) ; } let stack_size = decoder . read_u16 ( ) ? as usize ; let mut stack = Vec :: with_capacity ( stack_size ) ; for _ in 0 .. stack_size { stack . push ( parse_verification_type ( decoder ) ? ) ; } StackMapFrame :: Full { offset_delta , locals , stack , } } _ => return Err ( Error :: ReservedStackMapFrame ( frame_type ) ) , } ; table . push ( frame ) ; } Ok ( Attribute :: StackMapTable ( table ) ) }
Parses the `StackMapTable` attribute.
Parses the ` StackMapTable ` attribute .
decoder
&mut Decoder