gcc/rust/ChangeLog:
* ast/rust-ast-builder.h: Declare it.
* ast/rust-ast-builder.cc (Builder::return_expr): Define it.
LoopLabel::error (), loc, loc));
}
+std::unique_ptr<Expr>
+Builder::return_expr (std::unique_ptr<Expr> &&to_return)
+{
+ return std::unique_ptr<Expr> (
+ new ReturnExpr (std::move (to_return), {}, loc));
+}
+
std::unique_ptr<Stmt>
Builder::let (std::unique_ptr<Pattern> pattern, std::unique_ptr<Type> type,
std::unique_ptr<Expr> init) const
std::unique_ptr<Expr> &&tail_expr
= nullptr) const;
+ /* Create an early return expression with an optional expression */
+ std::unique_ptr<Expr> return_expr (std::unique_ptr<Expr> &&to_return
+ = nullptr);
+
/* Create a let binding with an optional type and initializer (`let <name> :
* <type> = <init>`) */
std::unique_ptr<Stmt> let (std::unique_ptr<Pattern> pattern,