fn visit_return_stmt(&mut self, _return_expr: &mut Option<Expr>) -> VisitorResult {
        let mut in_function = false;
        for state in self.state.iter().rev() {
            if state == &State::Function {
                in_function = true;
                break;
            }
        }

        if !in_function {
            let kind = SyntaxErrorKind::ReturnOutsideFunction {
                item: Item {
                    span: Span::empty(),
                    content: "".to_string(),
                },
            };

            let err = SyntaxError::new(kind);
            return Err(err);
        }

        Ok(())
    }
/// Verify that the `return` statement is inside of a function body.
Verify that the `return` statement is inside of a function body.
Verify that the ` return ` statement is inside of a function body .
fn visit_return_stmt(&mut self, _return_expr: &mut Option<Expr>) -> VisitorResult {
        let mut in_function = false;
        for state in self.state.iter().rev() {
            if state == &State::Function {
                in_function = true;
                break;
            }
        }
        if !in_function {
            let kind = SyntaxErrorKind::ReturnOutsideFunction {
                item: Item {
                    span: Span::empty(),
                    content: "".to_string(),
                },
            };
            let err = SyntaxError::new(kind);
            return Err(err);
        }
        Ok(())
    }
fn visit_return_stmt ( & mut self , _return_expr : & mut Option < Expr > ) -> VisitorResult { let mut in_function = false ; for state in self . state . iter ( ) . rev ( ) { if state == & State :: Function { in_function = true ; break ; } } if ! in_function { let kind = SyntaxErrorKind :: ReturnOutsideFunction { item : Item { span : Span :: empty ( ) , content : " " . to_string ( ) , } , } ; let err = SyntaxError :: new ( kind ) ; return Err ( err ) ; } Ok ( ( ) ) }
Verify that the `return` statement is inside of a function body.
Verify that the ` return ` statement is inside of a function body .
&mut self
_return_expr
&mut Option<Expr>