diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/subtypes.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ir/subtypes.h b/src/ir/subtypes.h index 0d8fccdbc..198a69b7a 100644 --- a/src/ir/subtypes.h +++ b/src/ir/subtypes.h @@ -113,12 +113,22 @@ struct SubTypes { } // Add the max depths of basic types. - // TODO: update when we get structtype and arraytype + // TODO: update when we get structtype for (auto type : types) { - HeapType basic = type.isData() ? HeapType::data : HeapType::func; + HeapType basic; + if (type.isStruct()) { + basic = HeapType::data; + } else if (type.isArray()) { + basic = HeapType::array; + } else { + assert(type.isSignature()); + basic = HeapType::func; + } depths[basic] = std::max(depths[basic], depths[type] + 1); } + depths[HeapType::data] = + std::max(depths[HeapType::data], depths[HeapType::array] + 1); depths[HeapType::eq] = std::max(Index(1), depths[HeapType::data] + 1); depths[HeapType::any] = depths[HeapType::eq] + 1; |