diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-01-18 21:42:53 +0000 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2021-01-20 09:59:22 +0000 |
commit | 4f6f18fe296d4729648eec0b77c8610f0b43445c (patch) | |
tree | a3897a28c43df3381df8bee90ab0a9501f32dd68 /gcc/rust/resolve/rust-ast-resolve-expr.h | |
parent | 12f7bd0fc4e9ab4e98869b5265aea6bacfb31d03 (diff) | |
download | gcc-4f6f18fe296d4729648eec0b77c8610f0b43445c.zip gcc-4f6f18fe296d4729648eec0b77c8610f0b43445c.tar.gz gcc-4f6f18fe296d4729648eec0b77c8610f0b43445c.tar.bz2 |
Support struct base reference in constructors
This creates implicit FieldAccessExpr or TupleIndexExprs for the missing
fields in the constructor using the base struct as the receiver.
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve-expr.h')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-expr.h | 8 |
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 91ed6e0..181124a 100644 --- a/gcc/rust/resolve/rust-ast-resolve-expr.h +++ b/gcc/rust/resolve/rust-ast-resolve-expr.h @@ -179,6 +179,14 @@ public: { ResolveExpr::go (&struct_expr.get_struct_name (), struct_expr.get_node_id ()); + + if (struct_expr.has_struct_base ()) + { + AST::StructBase &base = struct_expr.get_struct_base (); + ResolveExpr::go (base.get_base_struct ().get (), + struct_expr.get_node_id ()); + } + struct_expr.iterate ( [&] (AST::StructExprField *struct_field) mutable -> bool { ResolveStructExprField::go (struct_field, struct_expr.get_node_id ()); |