File tree 3 files changed +46
-2
lines changed
3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -221,11 +221,19 @@ class SubstMapperInternal : public TyTy::TyVisitor
221
221
resolved = type.handle_substitions (mappings);
222
222
}
223
223
224
+ void visit (TyTy::ArrayType &type) override
225
+ {
226
+ resolved = type.handle_substitions (mappings);
227
+ }
228
+
229
+ void visit (TyTy::SliceType &type) override
230
+ {
231
+ resolved = type.handle_substitions (mappings);
232
+ }
233
+
224
234
// nothing to do for these
225
235
void visit (TyTy::InferType &) override { gcc_unreachable (); }
226
236
void visit (TyTy::FnPtr &) override { gcc_unreachable (); }
227
- void visit (TyTy::ArrayType &) override { gcc_unreachable (); }
228
- void visit (TyTy::SliceType &) override { gcc_unreachable (); }
229
237
void visit (TyTy::BoolType &) override { gcc_unreachable (); }
230
238
void visit (TyTy::IntType &) override { gcc_unreachable (); }
231
239
void visit (TyTy::UintType &) override { gcc_unreachable (); }
Original file line number Diff line number Diff line change @@ -1508,6 +1508,22 @@ ArrayType::clone () const
1508
1508
element_type, get_combined_refs ());
1509
1509
}
1510
1510
1511
+ ArrayType *
1512
+ ArrayType::handle_substitions (SubstitutionArgumentMappings mappings)
1513
+ {
1514
+ auto mappings_table = Analysis::Mappings::get ();
1515
+
1516
+ ArrayType *ref = static_cast <ArrayType *> (clone ());
1517
+ ref->set_ty_ref (mappings_table->get_next_hir_id ());
1518
+
1519
+ // might be &T or &ADT so this needs to be recursive
1520
+ auto base = ref->get_element_type ();
1521
+ BaseType *concrete = Resolver::SubstMapperInternal::Resolve (base, mappings);
1522
+ ref->element_type = TyVar (concrete->get_ty_ref ());
1523
+
1524
+ return ref;
1525
+ }
1526
+
1511
1527
void
1512
1528
SliceType::accept_vis (TyVisitor &vis)
1513
1529
{
@@ -1581,6 +1597,22 @@ SliceType::clone () const
1581
1597
get_combined_refs ());
1582
1598
}
1583
1599
1600
+ SliceType *
1601
+ SliceType::handle_substitions (SubstitutionArgumentMappings mappings)
1602
+ {
1603
+ auto mappings_table = Analysis::Mappings::get ();
1604
+
1605
+ SliceType *ref = static_cast <SliceType *> (clone ());
1606
+ ref->set_ty_ref (mappings_table->get_next_hir_id ());
1607
+
1608
+ // might be &T or &ADT so this needs to be recursive
1609
+ auto base = ref->get_element_type ();
1610
+ BaseType *concrete = Resolver::SubstMapperInternal::Resolve (base, mappings);
1611
+ ref->element_type = TyVar (concrete->get_ty_ref ());
1612
+
1613
+ return ref;
1614
+ }
1615
+
1584
1616
void
1585
1617
BoolType::accept_vis (TyVisitor &vis)
1586
1618
{
Original file line number Diff line number Diff line change @@ -1665,6 +1665,8 @@ class ArrayType : public BaseType
1665
1665
1666
1666
HIR::Expr &get_capacity_expr () const { return capacity_expr; }
1667
1667
1668
+ ArrayType *handle_substitions (SubstitutionArgumentMappings mappings);
1669
+
1668
1670
private:
1669
1671
TyVar element_type;
1670
1672
HIR::Expr &capacity_expr;
@@ -1710,6 +1712,8 @@ class SliceType : public BaseType
1710
1712
return get_element_type ()->is_concrete ();
1711
1713
}
1712
1714
1715
+ SliceType *handle_substitions (SubstitutionArgumentMappings mappings);
1716
+
1713
1717
private:
1714
1718
TyVar element_type;
1715
1719
};
You can’t perform that action at this time.
0 commit comments