aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-09-15 18:09:39 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-09-15 18:14:02 +0100
commit57ebfd300bd6440880768e25edf876c158b78d4f (patch)
tree2d81a7c7d8654676314dfdc0b2bc2d47494f2e32
parent887598b92f28d69141b0091d09998672c07e131c (diff)
downloadgcc-57ebfd300bd6440880768e25edf876c158b78d4f.zip
gcc-57ebfd300bd6440880768e25edf876c158b78d4f.tar.gz
gcc-57ebfd300bd6440880768e25edf876c158b78d4f.tar.bz2
Add initial name-resolution for dyn trait objects
We can resolve the TypeBound during name resolution here but this is all encapsulated within TraitObjectTypeOneBound which needs its own TyTy abstraction during type checking. Addresses #197
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-type.h2
-rw-r--r--gcc/rust/resolve/rust-ast-resolve.cc8
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.h b/gcc/rust/resolve/rust-ast-resolve-type.h
index 9ad465a..137b16a 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.h
+++ b/gcc/rust/resolve/rust-ast-resolve-type.h
@@ -359,6 +359,8 @@ public:
type.get_type_pointed_to ()->accept_vis (*this);
}
+ void visit (AST::TraitObjectTypeOneBound &type) override;
+
private:
ResolveType (NodeId parent, bool canonicalize_type_with_generics)
: ResolverBase (parent),
diff --git a/gcc/rust/resolve/rust-ast-resolve.cc b/gcc/rust/resolve/rust-ast-resolve.cc
index fab70b5..a134f43 100644
--- a/gcc/rust/resolve/rust-ast-resolve.cc
+++ b/gcc/rust/resolve/rust-ast-resolve.cc
@@ -720,6 +720,14 @@ ResolveType::visit (AST::ArrayType &type)
ResolveExpr::go (type.get_size_expr ().get (), type.get_node_id ());
}
+void
+ResolveType::visit (AST::TraitObjectTypeOneBound &type)
+{
+ NodeId bound_resolved_id
+ = ResolveTypeBound::go (&type.get_trait_bound (), type.get_node_id ());
+ ok = bound_resolved_id != UNKNOWN_NODEID;
+}
+
// rust-ast-resolve-item.h
void