aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-ast.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-06-05 16:39:49 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-06-05 16:39:49 +0100
commit1c0d6ea02a74761a1756b65aaa3028054e9be680 (patch)
tree4d923ae000423777a7df9a99327450fbf7f6eef8 /gcc/rust/ast/rust-ast.h
parent1f1d9ed87d3e870f8e64ea28ba3e6bc898502255 (diff)
downloadgcc-1c0d6ea02a74761a1756b65aaa3028054e9be680.zip
gcc-1c0d6ea02a74761a1756b65aaa3028054e9be680.tar.gz
gcc-1c0d6ea02a74761a1756b65aaa3028054e9be680.tar.bz2
Add AST node_id to AST Trait Items
NodeIds are ids to map back to the AST from HIR. This is the building block to begin name resolution for traits. Addresses #395
Diffstat (limited to 'gcc/rust/ast/rust-ast.h')
-rw-r--r--gcc/rust/ast/rust-ast.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index ad9f803..0e25de2 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -1282,9 +1282,13 @@ class MacroItem : public Item
class TraitItem
{
protected:
+ TraitItem () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
+
// Clone function implementation as pure virtual method
virtual TraitItem *clone_trait_item_impl () const = 0;
+ NodeId node_id;
+
public:
virtual ~TraitItem () {}
@@ -1300,6 +1304,8 @@ public:
virtual void mark_for_strip () = 0;
virtual bool is_marked_for_strip () const = 0;
+
+ NodeId get_node_id () const { return node_id; }
};
/* Abstract base class for items used within an inherent impl block (the impl