pub(crate) fn into_closure(self, span: Span) -> Result<Closure, CompileError> {
        let this = ManuallyDrop::new(self);

        let level = this
            .levels
            .borrow_mut()
            .pop()
            .ok_or_else(|| CompileError::msg(&span, "missing scope"))?;

        match level {
            IndexScopeLevel::IndexClosure(closure) => Ok(Closure {
                kind: closure.kind,
                do_move: closure.do_move,
                captures: closure.captures,
                generator: closure.generator,
                has_await: closure.has_await,
            }),
            _ => Err(CompileError::msg(&span, "expected closure")),
        }
    }
/// Pop the last closure scope and return captured variables.
Pop the last closure scope and return captured variables.
Pop the last closure scope and return captured variables .
pub(crate) fn into_closure(self, span: Span) -> Result<Closure, CompileError> {
        let this = ManuallyDrop::new(self);
        let level = this
            .levels
            .borrow_mut()
            .pop()
            .ok_or_else(|| CompileError::msg(&span, "missing scope"))?;
        match level {
            IndexScopeLevel::IndexClosure(closure) => Ok(Closure {
                kind: closure.kind,
                do_move: closure.do_move,
                captures: closure.captures,
                generator: closure.generator,
                has_await: closure.has_await,
            }),
            _ => Err(CompileError::msg(&span, "expected closure")),
        }
    }
pub ( crate ) fn into_closure ( self , span : Span ) -> Result < Closure , CompileError > { let this = ManuallyDrop :: new ( self ) ; let level = this . levels . borrow_mut ( ) . pop ( ) . ok_or_else ( | | CompileError :: msg ( & span , " " ) ) ? ; match level { IndexScopeLevel :: IndexClosure ( closure ) => Ok ( Closure { kind : closure . kind , do_move : closure . do_move , captures : closure . captures , generator : closure . generator , has_await : closure . has_await , } ) , _ => Err ( CompileError :: msg ( & span , " " ) ) , } }
Pop the last closure scope and return captured variables.
Pop the last closure scope and return captured variables .
self
span
Span
self
span
Span