aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-ast-resolve-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-06-25 13:51:50 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-06-25 13:51:50 +0100
commitf089723609077cd38821c15ad042a45936f949e6 (patch)
treed8f8f094efbc8806111f4ee9b450792853852a48 /gcc/rust/resolve/rust-ast-resolve-expr.h
parentcb0db310b3dceff7a3ea6e05c002a3ab1239ac4a (diff)
downloadgcc-f089723609077cd38821c15ad042a45936f949e6.zip
gcc-f089723609077cd38821c15ad042a45936f949e6.tar.gz
gcc-f089723609077cd38821c15ad042a45936f949e6.tar.bz2
Add support for empty struct initilizer
Rust supports unit struct initilization such as S{} this takes this tree and resolves it fully. This should really be all desugared via HIR but that is in progress in another PR.
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve-expr.h')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-expr.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.h b/gcc/rust/resolve/rust-ast-resolve-expr.h
index f163ef5b..bbd8818 100644
--- a/gcc/rust/resolve/rust-ast-resolve-expr.h
+++ b/gcc/rust/resolve/rust-ast-resolve-expr.h
@@ -219,6 +219,14 @@ public:
ResolveExpr::go (elems.get_elem_to_copy ().get (), elems.get_node_id ());
}
+ // this this an empty struct constructor like 'S {}'
+ void visit (AST::StructExprStruct &struct_expr) override
+ {
+ ResolveExpr::go (&struct_expr.get_struct_name (),
+ struct_expr.get_node_id ());
+ }
+
+ // this this a struct constructor with fields
void visit (AST::StructExprStructFields &struct_expr) override
{
ResolveExpr::go (&struct_expr.get_struct_name (),