// Finding scopes
// ==============
/// Finds the loop scope for a given label. This is used for
/// resolving `break` and `continue`.
Finding scopes
Finds the loop scope for a given label. This is used for
resolving `break` and `continue`.
Finding scopes Finds the loop scope for a given label . This is used for resolving ` break ` and ` continue ` .
pub fn find_loop_scope(&mut self,
                           span: Span,
                           label: Option<CodeExtent>)
                           -> &mut LoopScope {
        let loop_scopes = &mut self.loop_scopes;
        match label {
            None => {
                // no label? return the innermost loop scope
                loop_scopes.iter_mut().rev().next()
            }
            Some(label) => {
                // otherwise, find the loop-scope with the correct id
                loop_scopes.iter_mut()
                           .rev()
                           .filter(|loop_scope| loop_scope.extent == label)
                           .next()
            }
        }.unwrap_or_else(|| span_bug!(span, "no enclosing loop scope found?"))
    }
pub fn find_loop_scope ( & mut self , span : Span , label : Option < CodeExtent > ) -> & mut LoopScope { let loop_scopes = & mut self . loop_scopes ; match label { None => { // no label? return the innermost loop scope loop_scopes . iter_mut ( ) . rev ( ) . next ( ) } Some ( label ) => { // otherwise, find the loop-scope with the correct id loop_scopes . iter_mut ( ) . rev ( ) . filter ( | loop_scope | loop_scope . extent == label ) . next ( ) } } . unwrap_or_else ( | | span_bug ! ( span " " ) ) }
Finding scopes
Finds the loop scope for a given label.
Finding scopes Finds the loop scope for a given label .
&mut self
span
Span
label
Option<CodeExtent>