@@ -382,6 +382,7 @@ class GlobalTypeRewriter {
382382 // used to define the new type in the TypeBuilder.
383383 virtual void modifyStruct (HeapType oldType, Struct& struct_) {}
384384 virtual void modifyArray (HeapType oldType, Array& array) {}
385+ virtual void modifyContinuation (HeapType oldType, Continuation& sig) {}
385386 virtual void modifySignature (HeapType oldType, Signature& sig) {}
386387
387388 // This additional hook is called after modify* and other operations, and
@@ -490,16 +491,19 @@ class TypeMapper : public GlobalTypeRewriter {
490491 mapTypes (newMapping);
491492 }
492493
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+
493502 Type getNewType (Type type) {
494503 if (!type.isRef ()) {
495504 return type;
496505 }
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 ())));
503507 }
504508
505509 void modifyStruct (HeapType oldType, Struct& struct_) override {
@@ -513,6 +517,10 @@ class TypeMapper : public GlobalTypeRewriter {
513517 void modifyArray (HeapType oldType, Array& array) override {
514518 array.element .type = getNewType (oldType.getArray ().element .type );
515519 }
520+ void modifyContinuation (HeapType oldType,
521+ Continuation& continuation) override {
522+ continuation.type = getNewHeapType (oldType.getContinuation ().type );
523+ }
516524 void modifySignature (HeapType oldSignatureType, Signature& sig) override {
517525 auto getUpdatedTypeList = [&](Type type) {
518526 std::vector<Type> vec;
0 commit comments