/// Find the loop with the matching label.
Find the loop with the matching label.
Find the loop with the matching label .
pub(crate) fn walk_until_label(
        &self,
        storage: &Storage,
        source: &Source,
        expected: ast::Label,
    ) -> CompileResult<(Loop, Vec<usize>)> {
        use crate::parsing::Resolve as _;
        let span = expected.span();
        let expected = expected.resolve(storage, source)?;
        let mut to_drop = Vec::new();
        for l in self.loops.borrow().iter().rev() {
            to_drop.extend(l.drop);
            let label = match l.label {
                Some(label) => label,
                None => {
                    continue;
                }
            };
            let label = label.resolve(storage, source)?;
            if expected == label {
                return Ok((*l, to_drop));
            }
        }
        Err(CompileError::new(
            span,
            CompileErrorKind::MissingLoopLabel {
                label: expected.as_ref().into(),
            },
        ))
    }
pub ( crate ) fn walk_until_label ( & self , storage : & Storage , source : & Source , expected : ast :: Label , ) -> CompileResult < ( Loop , Vec < usize > ) > { use crate :: parsing :: Resolve as _ ; let span = expected . span ( ) ; let expected = expected . resolve ( storage , source ) ? ; let mut to_drop = Vec :: new ( ) ; for l in self . loops . borrow ( ) . iter ( ) . rev ( ) { to_drop . extend ( l . drop ) ; let label = match l . label { Some ( label ) => label , None => { continue ; } } ; let label = label . resolve ( storage , source ) ? ; if expected == label { return Ok ( ( * l , to_drop ) ) ; } } Err ( CompileError :: new ( span , CompileErrorKind :: MissingLoopLabel { label : expected . as_ref ( ) . into ( ) , } , ) ) }
Find the loop with the matching label.
Find the loop with the matching label .
&self
storage
&Storage
source
&Source
expected
ast::Label