aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-ast-builder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/ast/rust-ast-builder.cc')
-rw-r--r--gcc/rust/ast/rust-ast-builder.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast-builder.cc b/gcc/rust/ast/rust-ast-builder.cc
index d10b64e..deef429 100644
--- a/gcc/rust/ast/rust-ast-builder.cc
+++ b/gcc/rust/ast/rust-ast-builder.cc
@@ -18,9 +18,11 @@
#include "rust-ast-builder.h"
#include "rust-ast-builder-type.h"
+#include "rust-ast.h"
#include "rust-common.h"
#include "rust-expr.h"
#include "rust-path.h"
+#include "rust-item.h"
#include "rust-token.h"
namespace Rust {
@@ -182,6 +184,19 @@ Builder::deref (std::unique_ptr<Expr> &&of) const
return std::unique_ptr<Expr> (new DereferenceExpr (std::move (of), {}, loc));
}
+std::unique_ptr<Stmt>
+Builder::struct_struct (std::string struct_name,
+ std::vector<std::unique_ptr<GenericParam>> &&generics,
+ std::vector<StructField> &&fields)
+{
+ auto is_unit = fields.empty ();
+
+ return std::unique_ptr<Stmt> (
+ new StructStruct (std::move (fields), struct_name, std::move (generics),
+ WhereClause::create_empty (), is_unit,
+ Visibility::create_private (), {}, loc));
+}
+
std::unique_ptr<Expr>
Builder::struct_expr_struct (std::string struct_name) const
{