@@ -382,6 +382,7 @@ class GlobalTypeRewriter {
382
382
// used to define the new type in the TypeBuilder.
383
383
virtual void modifyStruct (HeapType oldType, Struct& struct_) {}
384
384
virtual void modifyArray (HeapType oldType, Array& array) {}
385
+ virtual void modifyContinuation (HeapType oldType, Continuation& sig) {}
385
386
virtual void modifySignature (HeapType oldType, Signature& sig) {}
386
387
387
388
// This additional hook is called after modify* and other operations, and
@@ -490,16 +491,19 @@ class TypeMapper : public GlobalTypeRewriter {
490
491
mapTypes (newMapping);
491
492
}
492
493
494
+ HeapType getNewHeapType (HeapType type) {
495
+ auto iter = mapping.find (type);
496
+ if (iter != mapping.end ()) {
497
+ return iter->second ;
498
+ }
499
+ return type;
500
+ }
501
+
493
502
Type getNewType (Type type) {
494
503
if (!type.isRef ()) {
495
504
return type;
496
505
}
497
- auto heapType = type.getHeapType ();
498
- auto iter = mapping.find (heapType);
499
- if (iter != mapping.end ()) {
500
- return getTempType (Type (iter->second , type.getNullability ()));
501
- }
502
- return getTempType (type);
506
+ return getTempType (type.with (getNewHeapType (type.getHeapType ())));
503
507
}
504
508
505
509
void modifyStruct (HeapType oldType, Struct& struct_) override {
@@ -513,6 +517,10 @@ class TypeMapper : public GlobalTypeRewriter {
513
517
void modifyArray (HeapType oldType, Array& array) override {
514
518
array.element .type = getNewType (oldType.getArray ().element .type );
515
519
}
520
+ void modifyContinuation (HeapType oldType,
521
+ Continuation& continuation) override {
522
+ continuation.type = getNewHeapType (oldType.getContinuation ().type );
523
+ }
516
524
void modifySignature (HeapType oldSignatureType, Signature& sig) override {
517
525
auto getUpdatedTypeList = [&](Type type) {
518
526
std::vector<Type> vec;
0 commit comments