diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-02-16 15:40:28 +0000 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2021-03-01 10:35:07 +0000 |
commit | 9af2ae0ff91535da104db0d3828d863770439fad (patch) | |
tree | 57b375ba818f22c70066c87a4d9c2a1c1b78f69e /gcc/rust/ast/rust-ast.h | |
parent | 06bb1d6542a9d07f4d866613a5b039be7bcb5f95 (diff) | |
download | gcc-9af2ae0ff91535da104db0d3828d863770439fad.zip gcc-9af2ae0ff91535da104db0d3828d863770439fad.tar.gz gcc-9af2ae0ff91535da104db0d3828d863770439fad.tar.bz2 |
Support Generic arguments to Structs
This removes StructFieldType from the TyTy base as it is not a type that
can be unified against.
It adds in a substition mapper implementation which will likely change
over time when this this support is extended over to Functions and
TupleStructs.
Note generic argument binding is not supported as part of this yet.
Fixes #235
Diffstat (limited to 'gcc/rust/ast/rust-ast.h')
-rw-r--r-- | gcc/rust/ast/rust-ast.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index 7316865..7d3a075 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -1209,9 +1209,18 @@ public: virtual void accept_vis (ASTVisitor &vis) = 0; + virtual Location get_locus_slow () const = 0; + + NodeId get_node_id () { return node_id; } + protected: + GenericParam () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {} + GenericParam (NodeId node_id) : node_id (node_id) {} + // Clone function implementation as pure virtual method virtual GenericParam *clone_generic_param_impl () const = 0; + + NodeId node_id; }; // A lifetime generic parameter (as opposed to a type generic parameter) @@ -1251,6 +1260,10 @@ public: void accept_vis (ASTVisitor &vis) override; + Location get_locus () const { return locus; } + + Location get_locus_slow () const override final { return get_locus (); } + protected: /* Use covariance to implement clone function as returning this object rather * than base */ |