aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir/rust-ast-lower-struct-field-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2020-12-30 22:13:41 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-01-06 10:01:17 +0000
commit36ebe9a0380694c8517536eb37c7134f1323a30b (patch)
tree06901ff25aa5ea093184e0713bd0363735408959 /gcc/rust/hir/rust-ast-lower-struct-field-expr.h
parent467141184aa274126ff7e2a41d08bb621b7a3fdf (diff)
downloadgcc-36ebe9a0380694c8517536eb37c7134f1323a30b.zip
gcc-36ebe9a0380694c8517536eb37c7134f1323a30b.tar.gz
gcc-36ebe9a0380694c8517536eb37c7134f1323a30b.tar.bz2
This brings structs back in post HIR changes. It supports structs
where no base struct is referenced and the constructor is in order.
Diffstat (limited to 'gcc/rust/hir/rust-ast-lower-struct-field-expr.h')
-rw-r--r--gcc/rust/hir/rust-ast-lower-struct-field-expr.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-struct-field-expr.h b/gcc/rust/hir/rust-ast-lower-struct-field-expr.h
new file mode 100644
index 0000000..1b444a5
--- /dev/null
+++ b/gcc/rust/hir/rust-ast-lower-struct-field-expr.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2020 Free Software Foundation, Inc.
+
+// This file is part of GCC.
+
+// GCC is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3, or (at your option) any later
+// version.
+
+// GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef RUST_AST_LOWER_STRUCT_FIELD_EXPR
+#define RUST_AST_LOWER_STRUCT_FIELD_EXPR
+
+#include "rust-diagnostics.h"
+#include "rust-ast-lower-base.h"
+
+namespace Rust {
+namespace HIR {
+
+class ASTLowerStructExprField : public ASTLoweringBase
+{
+public:
+ static HIR::StructExprField *translate (AST::StructExprField *field)
+ {
+ ASTLowerStructExprField compiler;
+ field->accept_vis (compiler);
+ rust_assert (compiler.translated != nullptr);
+
+ // compiler.mappings->insert_hir_expr (
+ // compiler.translated->get_mappings ().get_crate_num (),
+ // compiler.translated->get_mappings ().get_hirid (),
+ // compiler.translated);
+
+ return compiler.translated;
+ }
+
+ ~ASTLowerStructExprField () {}
+
+ void visit (AST::StructExprFieldIdentifierValue &field);
+
+private:
+ ASTLowerStructExprField () : translated (nullptr) {}
+
+ HIR::StructExprField *translated;
+};
+
+} // namespace HIR
+} // namespace Rust
+
+#endif // RUST_AST_LOWER_STRUCT_FIELD_EXPR